You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[FIXED JENKINS-27708][FIXED JENKINS-27871] Ensure that identification of blocked tasks is using the live state.
- The creation of a snapshot itself should be relatively cheap given the expected rate of
job execution. You probably would need 100's of jobs starting execution every iteration
of maintain() before this could even start to become an issue and likely the calculation
of isBuildBlocked(p) will become a bottleneck before updateSnapshot() will. Additionally
since the snapshot itself only ever has at most one reference originating outside of the stack
it should remain in the eden space and thus be cheap to GC.
- JENKINS-27708 comments 225819 and 225906 provide more complex but logically equivalent fixes of
this issue. I am favouring this approach as it is simpler and provides less scope for error as any
new helper methods can just rely on the snapshot being up to date whereas with the other
two candidates if a new helper method is introduced there is the potential to miss adding support
for the live view. The comment 225819 has the risk of introducing extra lock contention while
the comment 225906 version forces every access to the helper methods to pass a second memory
barrier
(cherry picked from commit 5880ed8)
Copy file name to clipboardexpand all lines: core/src/main/java/hudson/model/Queue.java
+16-1
Original file line number
Diff line number
Diff line change
@@ -1335,7 +1335,10 @@ public void maintain() {
1335
1335
finalQueueSorters = sorter;
1336
1336
if (s != null)
1337
1337
s.sortBuildableItems(buildables);
1338
-
1338
+
1339
+
// Ensure that identification of blocked tasks is using the live state: JENKINS-27708 & JENKINS-27871
1340
+
updateSnapshot();
1341
+
1339
1342
// allocate buildable jobs to executors
1340
1343
for (BuildableItemp : newArrayList<BuildableItem>(
1341
1344
buildables)) {// copy as we'll mutate the list in the loop
@@ -1372,6 +1375,18 @@ public void maintain() {
1372
1375
makePending(p);
1373
1376
else
1374
1377
LOGGER.log(Level.FINE, "BuildableItem {0} with empty work units!?", p);
1378
+
1379
+
// Ensure that identification of blocked tasks is using the live state: JENKINS-27708 & JENKINS-27871
1380
+
// The creation of a snapshot itself should be relatively cheap given the expected rate of
1381
+
// job execution. You probably would need 100's of jobs starting execution every iteration
1382
+
// of maintain() before this could even start to become an issue and likely the calculation
1383
+
// of isBuildBlocked(p) will become a bottleneck before updateSnapshot() will. Additionally
1384
+
// since the snapshot itself only ever has at most one reference originating outside of the stack
1385
+
// it should remain in the eden space and thus be cheap to GC.
1386
+
// See https://issues.jenkins-ci.org/browse/JENKINS-27708?focusedCommentId=225819&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-225819
1387
+
// or https://issues.jenkins-ci.org/browse/JENKINS-27708?focusedCommentId=225906&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-225906
0 commit comments