Details
-
Bug
-
Status: Resolved
-
Critical
-
Resolution: Fixed
-
2.0.9
-
None
-
None
Description
When we call the ConnectionRequest.cancel() method, it does :
public void cancel() { if (!isDone()) { super.cancel(); cancelQueue.add(this); startupWorker(); wakeup(); }
The problem is that the isDone() method is :
public boolean isDone() { synchronized (lock) { return ready; } }
and the super.cancel() method is :
public void cancel() {
setValue(CANCELED);
}
with the setValue() method :
public void setValue(Object newValue) { synchronized (lock) { // Allowed only once. if (ready) { return; } result = newValue; ready = true; ...
At this point, we may have the 'ready' flag set to false, enter into the super.cancel() method, and have the 'ready' flag set to true when we check it again, but still we will add the current connectRequest into the cancel queue, when we should not.