Troubleshooting fork not syncing

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server と Data Center のみ - この記事は、サーバーおよびデータセンター プラットフォームのアトラシアン製品にのみ適用されます。

問題

Fork syncing is not happening for a specific repo.

The atlassian-bitbucket.log shows:

atlassian-bitbucket.log
2015-06-25 15:25:55,327 ERROR [threadpool:thread-136948]  c.a.s.i.c.StateTransferringExecutor Error while processing asynchronous task
java.lang.NoSuchMethodError: com.atlassian.bitbucket.pull.PullRequestService.findInDirection(Lcom.atlassian.bitbucket/pull/PullRequestDirection;ILjava/lang/String;Lcom.atlassian.bitbucket/pull/PullRequestState;Lcom.atlassian.bitbucket/pull/PullRequestOrder;Lcom.atlassian.bitbucket/util/PageRequest;)Lcom.atlassian.bitbucket/util/Page;
  at com.izymes.workzone.hook.UpdateApprovalHook$1.get(UpdateApprovalHook.java:91) ~[na:na]
  at com.atlassian.bitbucket.util.PagedIterable.iterator(PagedIterable.java:23) ~[bitbucket-util-3.1.5.jar:na]
  at com.izymes.workzone.hook.UpdateApprovalHook.onReceive(UpdateApprovalHook.java:98) ~[na:na]
  at com.atlassian.bitbucket.internal.hook.DefaultBuiltInHookHandlerFactory$2.handle(DefaultBuiltInHookHandlerFactory.java:69) ~[bitbucket-service-impl-3.1.5.jar:na]
  at com.atlassian.bitbucket.internal.hook.DefaultHookService.doHandleRequest(DefaultHookService.java:353) ~[bitbucket-service-impl-3.1.5.jar:na]
  at com.atlassian.bitbucket.internal.hook.DefaultHookService.handleRequest(DefaultHookService.java:339) ~[bitbucket-service-impl-3.1.5.jar:na]
  at com.atlassian.bitbucket.internal.hook.DefaultHookService.handleRawRequest(DefaultHookService.java:250) ~[bitbucket-service-impl-3.1.5.jar:na]
  at com.atlassian.bitbucket.internal.hook.DefaultHookService$2$1.run(DefaultHookService.java:210) ~[bitbucket-service-impl-3.1.5.jar:na]
  at com.atlassian.bitbucket.internal.concurrent.StateTransferringExecutor$StateTransferringRunnable.run(StateTransferringExecutor.java:69) ~[bitbucket-platform-3.1.5.jar:na]
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0]
  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [na:1.7.0]
  at java.util.concurrent.FutureTask.run(FutureTask.java:166) [na:1.7.0]
  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [na:1.7.0]
  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [na:1.7.0]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0]
  at java.lang.Thread.run(Thread.java:722) [na:1.7.0]
  ... 1 frame trimmed

 

診断

In general, these are the guidelines that should be used to analyze fork syncing issues.

  • First off, make sure your profiling logging is enabled.
  • Generate a  Support Zip (Admin >> Cog Icon >> Atlassian Support Tools >> Support Zip)
  • Identify the repo that is problematic. From your application.xml you can, for example, find that the repo CB/ssb is has the ID 391. 

  • The important thing now is identifying that the push actually happened. A line similar to that will show up in the profiling logs:

    atlassian-bitbucket-access.log
    2015-06-25 15:25:55,431 | ssh-scm-request-handler | 925x333140x0 | your@email.com | x05ojl
    [0ms] - /usr/local/bin/git receive-pack /software/data/data/repositories/391
  • Now you should continue on the profiling logs to see what's happening. As part of processing that push, you should be able to see the pre-receive and post-receive hooks call back into Bitbucket Server. The output below is for the 391 repo which is failing to fork sync properly:

    ##### Pre-receive hook call #####
    2015-06-25 15:25:55,267 | threadpool:thread-136947 | - | - | -
    [210ms] - DefaultHookService hook callback git-pre-receive for repository 391
      [1ms] - Repository com.atlassian.bitbucket.repository.RepositoryService.getById(int)
        [0ms] - Object com.atlassian.bitbucket.internal.Dao.getById(Object)
      [0ms] - boolean com.atlassian.bitbucket.user.PermissionService.isRepositoryAccessible(Repository)
      [0ms] - ScmHookHandlerFactory com.atlassian.bitbucket.scm.ScmService.getHookHandlerFactory(Repository)
      [204ms] - com.atlassian.bitbucket.internal.hook.DefaultBuiltInHookHandlerFactory$1#preReceive
        [7ms] - com.izymes.workzone.hook.PushToBranchHook#onReceive
          [2ms] - String com.atlassian.bitbucket.internal.plugin.PluginSettingDao.get(String,String)
        [0ms] - com.atlassian.bitbucket.internal.scm.git.pull.PullRequestRefGuardHook#onReceive
        [189ms] - com.atlassian.bitbucket.internal.hook.repository.PreReceiveRepositoryHookAdapter#onReceive
          [185ms] - boolean com.atlassian.bitbucket.internal.hook.repository.InternalRepositoryHookService.visitEnabledHooks(Repository,Class,RepositoryHookSettingsCallback)
            [2ms] - List com.atlassian.bitbucket.internal.hook.repository.RepositoryHookStatusDao.findEnabledHooks(InternalRepository,Collection)
            [4ms] - Map com.atlassian.bitbucket.internal.repository.InternalRepositorySettingsService.findByRepository(Repository,Collection)
              [3ms] - Iterable com.atlassian.bitbucket.internal.repository.RepositorySettingsDao.findByRepository(InternalRepository,Collection)
            [0ms] - com.atlassian.bitbucket.plugin.hooks.protectbranch.ProtectUnmergedBranchHook#onReceive
            [117ms] - com.atlassian.bitbucket.plugin.hooks.forcepush.ForcePushHook#onReceive
              [0ms] - boolean com.atlassian.bitbucket.user.PermissionService.isRepositoryAccessible(Repository)
              [0ms] - Ticket com.atlassian.bitbucket.throttle.ThrottleService.acquireTicket(String)
              [112ms] - Page com.atlassian.bitbucket.commit.CommitService.getChangesetsBetween(ChangesetsBetweenRequest,PageRequest)
                [0ms] - ScmCommandFactory com.atlassian.bitbucket.scm.ScmService.getCommandFactory(Repository)
                [105ms] - /usr/local/bin/git rev-list --format=%H%x02%h%x02%P%x02%p%x02%aN%x02%aE%x02%at%n%B%n%x03 --ignore-missing --stdin --
                [0ms] - String com.atlassian.bitbucket.internal.plugin.PluginSettingDao.get(String,String)
                [0ms] - String com.atlassian.bitbucket.internal.plugin.PluginSettingDao.get(String,String)
                [0ms] - Map com.atlassian.bitbucket.internal.content.IndexedChangesetDao.getAttributesForChangesets(Collection,Collection)
                [0ms] - Map com.atlassian.bitbucket.internal.repository.RepositoryActivityDao.countCommentsByCommit(int,Set)
                [0ms] - Map com.atlassian.bitbucket.internal.user.InternalUserService.mapUsersByEmail(Set)
            [62ms] - com.teslamotors.bitbucket.logchecker.CommitLogMessagePreReceiveHook#onReceive
        [8ms] - com.atlassian.bitbucket.hooks.permissions.internal.BranchPermissionHook#onReceive
    
     
    ##### Post-receive hook call #####
    2015-06-25 15:25:55,324 | threadpool:thread-136948 | - | - | -
    [10ms] - DefaultHookService hook callback git-post-receive for repository 391
      [0ms] - Repository com.atlassian.bitbucket.repository.RepositoryService.getById(int)
        [0ms] - Object com.atlassian.bitbucket.internal.Dao.getById(Object)
      [0ms] - boolean com.atlassian.bitbucket.user.PermissionService.isRepositoryAccessible(Repository)
      [0ms] - ScmHookHandlerFactory com.atlassian.bitbucket.scm.ScmService.getHookHandlerFactory(Repository)
      [5ms] - com.atlassian.bitbucket.internal.hook.DefaultBuiltInHookHandlerFactory$2#postReceive
        [5ms] - com.izymes.workzone.hook.UpdateApprovalHook#onReceive
          [0ms] - String com.atlassian.bitbucket.internal.plugin.PluginSettingDao.get(String,String)
  •  The DefaultHookService hook callback git-post-receive for repository 391 trace shows the problem. It hits the Workzone for Bitbucket Server plugin and that's the last thing shown on com.izymes.workzone.hook.UpdateApprovalHook#onReceive

  • This is how the post-receive output for a repository where fork syncing is working should look:

    2015-06-25 15:18:31,191 | threadpool:thread-136704 | - | - | -
    [30ms] - DefaultHookService hook callback git-post-receive for repository 427
      [0ms] - Repository com.atlassian.bitbucket.repository.RepositoryService.getById(int)
        [0ms] - Object com.atlassian.bitbucket.internal.Dao.getById(Object)
      [0ms] - boolean com.atlassian.bitbucket.user.PermissionService.isRepositoryAccessible(Repository)
      [1ms] - ScmHookHandlerFactory com.atlassian.bitbucket.scm.ScmService.getHookHandlerFactory(Repository)
      [24ms] - com.atlassian.bitbucket.internal.hook.DefaultBuiltInHookHandlerFactory$2#postReceive
        [5ms] - com.izymes.workzone.hook.UpdateApprovalHook#onReceive
          [2ms] - String com.atlassian.bitbucket.internal.plugin.PluginSettingDao.get(String,String)
        [19ms] - com.atlassian.bitbucket.internal.hook.PushPostReceiveHook#onReceive
    • Notice that, after the Workzone hook, repository 427's callback hits the PushPostReceiveHook. That hook raises RepositoryPushEvent, which in turn triggers fork syncing. Since that's not called for CB/ssb, fork syncing doesn't run.
    • Notice that the thread ID, threadpool:thread-136948, is the same between the Workzone stack trace and the post-receive callback entry in the profiling logs. As you can see, the outdated version of the Workzone plugin is calling a method that was removed in Bitbucket Server 3.0.

原因

The PushPostReceiveHook was not called on the example above because the Workzone plugin was outdated. The instance (Bitbucket Server 3.1.5.) was running Workzone 1.3.1. According to its version history, 1.3.1 is compatible with Bitbucket Server 2.5.0-2.12.6. When the instance was upgraded that plugin was broken causing the logs reported on the problem description.

回避策

Disable the Workzone Plugin.

ソリューション

Look at the plugin version history and upgrade it to a version that is compatible with your Bitbucket Server instance.

最終更新日: 2016 年 2 月 26 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.