Uploaded image for project: 'SR for Bitbucket - Development'
  1. SR for Bitbucket - Development
  2. SRBITB-295

Upgrading above 5.0.13 causes upgrade to hang in the UPM when using some databases

    Details

    • Type: Bug
    • Status: Done (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 5.2.10
    • Fix Version/s: 5.3.8
    • Labels:
      None
    • Sprint:
      Sprint 37 - Ends Jan 29
    • Critical Points:
      1.4

      Description

      This happens for MySQL and Microsoft SQL Server. This happens because AO (active objects) is not always ready when we register the SR items from AO.

      AO always needs to perform a migration of tables on an upgrade, but it must do this first before we use AO. Therfore we need to wait for AO to become fully initialized on startup.

      Workaround:

      As a workaround uninstalling ScriptRunner and reinstalling fixes the issue in MS SQL Server. In MySQL restarting the Bitbucket Server instance alone will fix the issue.

      To reproduce:

      1. Configure Microsoft SQL Server as Bitbucket's data store (https://confluence.atlassian.com/bitbucketserver/connecting-bitbucket-server-to-sql-server-776640385.html)
      2. Configure a few script hooks & event handlers
      3. Upgrade ScriptRunner from 5.2.6 to 5.2.10

      The upgrade will stall out around 90% according to the UPM UI. Enter Safe Mode, then exit safe mode to stop that process, and you'll begin to see errors in the logs, such as:

      2018-02-16 14:36:59 [http-nio-8080-exec-8] ERROR c.a.e.i.AsynchronousAbleEventDispatcher - There was an exception thrown trying to dispatch event [com.atlassian.plugin.event.events.PluginEnabledEvent for com.onresolve.stash.groovy.groovyr
      unner] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.onresolve.scriptrunner.runner.FullSystemStartedInitialiser.onPluginEnabled(com.atlassian.plugin.event.events.PluginEnabledEvent), listener=com.onresolve.
      scriptrunner.fragments.BitbucketFragmentsManager@49b96b3b}]
      java.lang.RuntimeException: java.util.concurrent.CancellationException: Task was cancelled.. Listener: com.onresolve.scriptrunner.fragments.BitbucketFragmentsManager event: com.atlassian.plugin.event.events.PluginEnabledEvent
              at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:55)
              at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:38)
              at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:457)
              at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:88)
              at com.atlassian.event.internal.LockFreeEventPublisher$Publisher.dispatch(LockFreeEventPublisher.java:222)
              at com.atlassian.event.internal.LockFreeEventPublisher.publish(LockFreeEventPublisher.java:95)
              at com.atlassian.stash.internal.event.TransactionAwareEventPublisher.internalPublish(TransactionAwareEventPublisher.java:155)
              at com.atlassian.stash.internal.event.TransactionAwareEventPublisher.publish(TransactionAwareEventPublisher.java:99)
              at com.atlassian.plugin.event.impl.DefaultPluginEventManager.broadcast(DefaultPluginEventManager.java:83)
              at com.atlassian.plugin.manager.DefaultPluginManager.broadcastIgnoreError(DefaultPluginManager.java:2135)
              at com.atlassian.plugin.manager.DefaultPluginManager.enablePlugins(DefaultPluginManager.java:1706)
              at com.atlassian.stash.internal.plugin.ClusteredPluginController.enablePlugins(ClusteredPluginController.java:50)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
      //.......tuncating the stack trace a bit here.....
      Caused by: java.util.concurrent.CancellationException: Future.cancel() was called.
              at com.google.common.util.concurrent.AbstractFuture$Sync.complete(AbstractFuture.java:378)
              at com.google.common.util.concurrent.AbstractFuture$Sync.cancel(AbstractFuture.java:355)
              at com.google.common.util.concurrent.AbstractFuture.cancel(AbstractFuture.java:131)
              at com.google.common.util.concurrent.ForwardingFuture.cancel(ForwardingFuture.java:
      

      Any hooks, merge checks, and other configured scripts will simply delay indefinitely.

        Attachments

          Issue Links

            Structure

              Activity

                People

                Assignee:
                amarkham Adam Markham
                Reporter:
                jcarter Jonny Carter
                Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Structure Helper Panel