Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-26169

Reduce number of StashPullRequestRescopedRemoteEvent from Bitbucket

XMLWordPrintable

      Issue Summary

      At present Bitbucket sends StashPullRequestRescopedRemoteEvent events to Bamboo and bamboo will consume them only in case if there are coming from forked repositories and it became a huge overhead on Bamboo as every event we get requires quite expensive processing to detect whether something changed. 

      Steps to Reproduce

      1. Create the application link between Bamboo and Bitbucket
      2. Create a pull request in Bitbucket and make the changes in source branch
      3. If there are huge number of open pull requests, Bamboo will received huge number of events and it takes time to process.

      Expected Results

      Reduce number of StashPullRequestRescopedRemoteEvent from Bitbucket

      Actual Results

      The below exception is thrown in the xxxxxxx.log file:

      atlassian-bamboo.log:2025-07-18 22:43:56,962 WARN [AtlassianEvent::1-BAM::EVENTS:pool-2-thread-84] [EventInvokerRunnable] Bamboo operation time: handling event com.atlassian.stash.plugin.remote.event.StashPullRequestRescopedRemoteEvent@774dd746[pullRequestId=1208,committer=testuser,repositoryProject=TESTREPO,repositorySlug=testcommit,sourceId=d71a1137-db77-3484-847a-4ba395e6a04c,sourceUrl=https://bitbucket.bamboo.com] by invoker com.atlassian.event.internal.ComparableListenerInvoker@2780fb79 took 161438 ms
      atlassian-bamboo.log:2025-07-18 22:43:57,019 WARN [AtlassianEvent::1-BAM::EVENTS:pool-2-thread-32] [EventInvokerRunnable] Bamboo operation time: handling event com.atlassian.stash.plugin.remote.event.StashPullRequestRescopedRemoteEvent@3a9ddc31[pullRequestId=1305,committer=testuser,repositoryProject=TESTREPO,repositorySlug=testcommit,sourceId=d71a1137-db77-3484-847a-4ba395e6a04c,sourceUrl=https://bitbucket.bamboo.com] by invoker com.atlassian.event.internal.ComparableListenerInvoker@2780fb79 took 176305 ms
      atlassian-bamboo.log:2025-07-18 22:43:57,022 WARN [AtlassianEvent::1-BAM::EVENTS:pool-2-thread-6] [EventInvokerRunnable] Bamboo operation time: handling event com.atlassian.stash.plugin.remote.event.StashPullRequestRescopedRemoteEvent@52ad6a47[pullRequestId=1166,committer=testuser,repositoryProject=TESTREPO,repositorySlug=testcommit,sourceId=d71a1137-db77-3484-847a-4ba395e6a04c,sourceUrl=https://bitbucket.bamboo.com] by invoker com.atlassian.event.internal.ComparableListenerInvoker@2780fb79 took 167026 ms
      

      Workaround

      Option 1:

      If Bamboo version is 10.2.6 or later, and if forked repositories are not in use, we can disable Bamboo processing these events with:

      -Dbamboo.disable.bbdc.change.detection.for.prs.from.forked.repos=true 
      

      To check if any plan is using this feature, can you please run the query below:

      SELECT count(*) FROM build_definition bd WHERE xml_definition_data like '%forkEnabledPullRequest%'; 
      

      If the result is 0, this workaround can be safely considered.

      Option 2

      If Bamboo version is less than 10.2.6, then disbale the Bamboo end point at the network level (For example Load balancer) before it reaches Bamboo. Please make sure forked repositories are not used as mentioned in Workaround 1

      <BAMBOO_BASE_URL>/rest/remote-event-consumer/latest/events/stash-pullrequest-rescoped-remote-event
      

              851f15845f55 Mateusz Szmal
              d4e7ab297885 Venkata Sateesh Pentela
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: