[JENKINS-64931] no need to synchronize on Queue as queue is using a Lock and this under certain conditions can generate a deadlock. look at the dump attached to the issue JENKINS-64931 (#5305)

Signed-off-by: olivier lamy <olamy@apache.org>
This commit is contained in:
Olivier Lamy authored and GitHub committed 2021-03-08 07:58:04 +00:00
1 parent 2269197eab
commit 8a6defe963
1 file changed
+7 -9
@@ -71,16 +71,14 @@ public final class FutureImpl extends AsyncFutureImpl<Executable> implements Que
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
Queue q = Jenkins.get().getQueue();
synchronized (q) {
synchronized (this) {
if(!executors.isEmpty()) {
if(mayInterruptIfRunning)
for (Executor e : executors)
e.interrupt();
return mayInterruptIfRunning;
}
return q.cancel(task);
synchronized (this) {
if(!executors.isEmpty()) {
if(mayInterruptIfRunning)
for (Executor e : executors)
e.interrupt();
return mayInterruptIfRunning;
}
return q.cancel(task);
}
}