CronetEngine.stopNetLog() looks racy, like it could hang |
||
Issue description
@Override
public void stopNetLog() {
synchronized (mLock) {
if (!mIsLogging) {
return;
}
checkHaveAdapter();
mStopNetLogCompleted = new ConditionVariable();
nativeStopNetLog(mUrlRequestContextAdapter);
mIsLogging = false;
}
mStopNetLogCompleted.block();
}
@CalledByNative
public void stopNetLogCompleted() {
mStopNetLogCompleted.open();
}
I imagine a hang looking like:
1. on thread #1: CronetEngine.startNetLog() called.
2. on thread #1: CronetEngine.stopNetLog() called, left waiting on mStopNetLogCompleted.block().
3. on thread #2: CronetEngine.startNetLog() called.
4. on thread #2: CronetEngine.stopNetLog() called, resets mStopNetLogCompleted to a new ConditionVariable.
Now thread #1 is left waiting forever. stopNetLogCompleted() will open the second ConditionVariable created in step #4.
,
Jan 2
,
Jan 3
|
||
►
Sign in to add a comment |
||
Comment 1 by pauljensen@chromium.org
, Jun 7 2017