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
Our profiler shows BaseOperationImpl.isCancelled spends 90% of the time in blocked state and we suspect it's causing deadlocks since it shares the same lock with other operations in the Operation class:
public final synchronized boolean isCancelled() {
return cancelled;
}
public final synchronized void cancel() {
cancelled = true;
synchronized (clones) {
Iterator<Operation> i = clones.iterator();
while(i.hasNext()) {
i.next().cancel();
}
}
wasCancelled();
callback.receivedStatus(CANCELLED);
callback.complete();
}
If the operation is cloned (original X, clone Y) and two threads call cancel():
Thread A calls X.cancel(), aquires X's lock and yields
Thread B calls Y.cancel(), aquires Y's lock, enters synchronized block, i.next() returns X, thread blocks on i.next().cancel() since thread A is already executing that function
Thread A resumes execution, its i.next() returns A and it blocks similar to B
Is this a valid situation that could happen?
The text was updated successfully, but these errors were encountered:
Our profiler shows
BaseOperationImpl.isCancelled
spends 90% of the time in blocked state and we suspect it's causing deadlocks since it shares the same lock with other operations in the Operation class:If the operation is cloned (original X, clone Y) and two threads call
cancel()
:X.cancel()
, aquires X's lock and yieldsY.cancel()
, aquires Y's lock, enters synchronized block,i.next()
returns X, thread blocks oni.next().cancel()
since thread A is already executing that functioni.next()
returns A and it blocks similar to BIs this a valid situation that could happen?
The text was updated successfully, but these errors were encountered: