Consider the following sequence of calls on a SimpleEntryImpl, done with the pending operation queue non-empty, and 1 external references:
1) OpenEntry
2) Close
Since the queue is non-empty, OpenEntry will queue OpenEntryInternal.
Close will reduce external reference count to 0, notice that, and queue a call to CloseInternal.
When OpenEntryInternal runs, it increases external reference count to 1, and returns the entry to caller.
When CloseInternal runs, it queues up a disk commit (if needed), and destruction of SimpleSynchronousEntry. When that finishes, CloseOperationComplete runs.
Debug builds will DCHECK fail here, due to external reference count (open_count_) being non-zero. Release builds will generally end up in
STATE_UNINITIALIZED, meaning further operations will usually fail. This will be reflected in UMA under SimpleCache.ReadResult == READ_RESULT_BAD_STATE
and WriteResult2 == SIMPLE_ENTRY_WRITE_RESULT_BAD_STATE.
Comment 1 by bugdroid1@chromium.org
, Jan 16