jenkinsci / jenkinsci/github-branch-source-plugin
Push event to branch not delivered to projectwhen concurrent webhook events arrive
- Dominant language
- Java
- Stars
- 217
- Forks
- 398
- Avg merge
- 30m
- Merged PRs (30d)
- 1
Description
### Jenkins and plugins versions report
# Summary
When two webhook events for the same repository arrive within ~2 seconds of each other (e.g., a push to `master` from a squash merge + an automatic branch deletion), the global `DefaultPushGHEventSubscriber` processes both events and reports matches, but one of the events is never delivered to the project-specific `MultiBranchProject` handler. The affected branch build is silently skipped — no build is triggered, no log entry appears in the project's `indexing/events.log`, and the only way to recover is a manual re-scan or a new push.
## Environment
Environment
```text
Jenkins: 2.504.3
github-branch-source: 1917.v9ee8a_39b_3d0d
github-plugin: 1.45.0
github-api: 1.330-492.v3941a_032db_2a_
Java: 17
OS: Ubuntu 22.04 (207 days uptime, no restart during incident)
```
## Evidence
```text
MultiBranchProject.log (global branch source handler) — both processed, interleaved:
[Mon Jul 13 10:17:26 CEST 2026] Received Push event to branch master in repository bt-advanced-analytics/mng-terraform UPDATED event
Found match against General/Terraform/mng-terraform-drift-dev
[Mon Jul 13 10:17:28 CEST 2026] Received Push event to branch feature/fix_perso_ai_hub in repository bt-advanced-analytics/mng-terraform REMOVED event
Found match against General/Terraform/mng-terraform
[Mon Jul 13 10:17:29 CEST 2026] Finished processing Push event to branch feature/fix_perso_ai_hub ... processed in 804ms. Matched 1.
Found match against General/Terraform/mng-terraform-drift-pre
Found match against General/Terraform/mng-terraform-drift-pro
Found match against General/Terraform/mng-terraform
[Mon Jul 13 10:17:38 CEST 2026] Finished processing Push event to branch master ... processed in 11697ms. Matched 5.
Note: the two events are processed concurrently (interleaved "Found match" lines). The delete event finishes first (804ms), the push to master finishes later (11697ms).
```
```text
jobs/General/jobs/Terraform/jobs/mng-terraform/indexing/events.log (project-specific handler):
(no entry at 10:17 CEST — the next entry is at 10:51 CEST, 34 minutes later)
The push to master was never delivered to this project handler despite "Matched 5" in the global log.
```
Comparison: push event without concurrency (works correctly)
39 minutes later, another push to master arrives with no concurrent events:
```text
[Mon Jul 13 10:56:42 CEST 2026] Received Push event to branch master ... UPDATED event
[Mon Jul 13 10:56:43 CEST 2026] Push event to branch master ... processed in 1.3 sec
This event is delivered to the project handler and triggers build #2313 successfully.
```
### What Operating System are you using (both controller, and any agents involved in the problem)?
Jenkins: 2.504.3
github-branch-source: 1917.v9ee8a_39b_3d0d
github-plugin: 1.45.0
github-api: 1.330-492.v3941a_032db_2a_
Java: 17
OS: Ubuntu 22.04 (207 days uptime, no restart during incident)
### Reproduction steps
1- Configure a Multibranch Pipeline (GitHub Branch Source) for a repository with "Automatically delete head branches" enabled in GitHub.
2- Open a PR and squash-merge it to master.
3-GitHub sends two webhook events nearly simultaneously:
-push to refs/heads/master (the squash merge commit)
-delete of refs/heads/feature/xyz (automatic branch cleanup)
4-Both events arrive within ~2 seconds.
### Expected Results
Both events are processed and delivered to the matching MultiBranchProject handlers. A build is triggered for the master branch.
### Actual Results
The global handler receives and processes both events (jenkins.log shows "Matched 5" for the push to master), but the project-specific handler (jobs/.../mng-terraform/indexing/events.log) has no entry for the push to master. No build is triggered. The delete event is processed normally.
### Anything else?
_No response_
### Are you interested in contributing a fix?
_No response_
Contributor guide
Research direction
Start with DefaultPushGHEventSubscriber and trace how matched events are dispatched to MultiBranchProject handlers, using the reported interleaved global log and project indexing/events.log as evidence. Reproduce two near-simultaneous push and branch-delete webhooks, then verify both events reach the project handler and trigger the expected master build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, java
- Domain
- backend, ci-cd
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100