llvm / llvm-zorg

Other
64 stars 94 forks source link

Buildbot could run builds on a single worker in order different to the order of commits #219

Open gkistanova opened 2 months ago

gkistanova commented 2 months ago

Here is the example of such case. The order of these two builds should be the other way around: https://lab.llvm.org/buildbot/#/builders/56/builds/1451 https://lab.llvm.org/buildbot/#/builders/56/builds/1452

Originally reported by @nikic - https://discourse.llvm.org/t/buildbot-started-commenting-prs-on-buid-failures/79738/13

slydiman commented 2 months ago

The gitpoller added changes and triggers the changes new event. The change record contains the correct timestamp in when_timestamp but it is not used anywhere. A scheduler calls addBuildsetForChanges() and finally addBuildset() in buildbot/master/buildbot/data/buildsets.py uses the current time for submitted_at. A lot of buildrequests may be added with the same submitted_at. It would be great to use when_timestamp as submitted_at. BuildChooserBase._fetchUnclaimedBrdicts() sorts brdicts by submitted_at and the order is undefined in case of the same submitted_at for few buildrequest.

The BuildChooserBase sorts by buildrequestid instead of submitted_at since v3.10.0. It seems it is necessary to update the buildbot to v3.10.0 at least or apply the patch https://github.com/buildbot/buildbot/commit/9b84a03cf0ae7661d433ba97a0274b31e858fe44