Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-39454] Do not consider pendings from scheduleInternal #2609

Merged
merged 1 commit into from Nov 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/src/main/java/hudson/model/Executor.java
Expand Up @@ -389,6 +389,9 @@ public SubTask call() throws Exception {
}

if (executable instanceof Actionable) {
if (LOGGER.isLoggable(Level.FINER)) {
LOGGER.log(FINER, "when running {0} from {1} we are copying {2} actions whereas the item currently has {3}", new Object[] {executable, workUnit.context.item, workUnit.context.actions, workUnit.context.item.getAllActions()});
}
for (Action action: workUnit.context.actions) {
((Actionable) executable).addAction(action);
}
Expand Down
13 changes: 11 additions & 2 deletions core/src/main/java/hudson/model/Queue.java
Expand Up @@ -612,6 +612,9 @@ public WaitingItem schedule(Task p, int quietPeriod, List<Action> actions) {
for (Item item : duplicatesInQueue) {
for (FoldableAction a : Util.filter(actions, FoldableAction.class)) {
a.foldIntoExisting(item, p, actions);
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "after folding {0}, {1} includes {2}", new Object[] {a, item, item.getAllActions()});
}
}
}

Expand Down Expand Up @@ -1049,7 +1052,13 @@ private List<Item> liveGetItems(Task t) {
List<Item> result = new ArrayList<Item>();
result.addAll(blockedProjects.getAll(t));
result.addAll(buildables.getAll(t));
result.addAll(pendings.getAll(t));
// Do not include pendings—we have already finalized WorkUnitContext.actions.
if (LOGGER.isLoggable(Level.FINE)) {
List<BuildableItem> thePendings = pendings.getAll(t);
if (!thePendings.isEmpty()) {
LOGGER.log(Level.FINE, "ignoring {0} during scheduleInternal", thePendings);
}
}
for (Item item : waitingList) {
if (item.task.equals(t)) {
result.add(item);
Expand Down Expand Up @@ -1414,7 +1423,7 @@ public void maintain() {
p.task.getFullDisplayName());
p.isPending = false;
pendings.remove(p);
makeBuildable(p);
makeBuildable(p); // TODO whatever this is for, the return value is being ignored, so this does nothing at all
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an unrelated bug. See #2510; we occasionally get here, but I have never figured out what this case means, and apparently this line does absolutely nothing. Maybe a regression from #1513? Clearly not covered by any existing tests.

}
}

Expand Down