mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-09 10:06:13 +00:00
[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:
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user