Concurrency issues when adding labels to an issue/PR
See original GitHub issueHi,
Some context: we are using the Hub4j GitHub API for our Quarkus Bot (it’s a GitHub App based on Quarkus and running as a GraalVM native executable).
The bot can automatically add labels based on triage rules but we started seeing concurrency issues when someone adds labels when the bot is also adding some. Believe it or not, this happened in real life.
AFAICS, the issue is that the GHIssue#addLabels()
method doesn’t really add the labels but set them. My understanding is that it should use this method: https://docs.github.com/en/rest/reference/issues#add-labels-to-an-issue and that’s not what is done here: https://github.com/hub4j/github-api/blob/6d86cfb4f60642ccfc3ad943eeb472e33e2ff9ec/src/main/java/org/kohsuke/github/GHIssue.java#L362-L374 : you set the labels based on the existing ones + the added ones instead of adding them, which can result in data loss if you’re not lucky.
The issue occurs when a label is added manually in the UI between the call at line 365 and the call at line 373: the labels added in the UI are lost, which is very unfortunate given they are critical to our workflow. You can see an example of this issue here: https://github.com/quarkusio/quarkus/pull/15402#event- - Georgios added the triage/backport?
label in the UI and the bot removed it while our bot is only adding labels.
Does it make any sense? Any chance this could be fixed?
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top GitHub Comments
@bitwiseman thanks a ton for the release!
@bitwiseman if it’s not too much work, could you release a new version with this fix? It’s hitting us pretty bad. Thanks!