Check resourceManager state first in getMoreLoop#1439
Check resourceManager state first in getMoreLoop#1439rozza wants to merge 1 commit intomongodb:masterfrom
Conversation
|
While I don't yet know what's wrong with the current code (before this PR), I am very much sure that we should neither remove the assertion, nor introduce locking to
@rozza I clearly remember reviewing a large PR created by you, where part of |
|
@stIncMale - yeah I recall there being many reviews of the original work on my repo culminating here: rozza/pull/404 Closing in favor of #1440 |
Thank you! |
JAVA-5516
Notes:
I have not been able to replicate this error:
The stacktrace shows that the
getMoreLoopmethod errored when returning results from the cursor because when setting the cursor viasetServerCursorthe following assertion failed:assertTrue(state.inProgress());.The only methods that manipulate the
stateflag are:tryStartOperationsets state iffstate == IDLEendOperationsets state ifstate == OPERATION_IN_PROGRESSorCLOSE_PENDINGclosesets state ifstate == OPERATION_IN_PROGRESStoCLOSE_PENDINGotherwise sets it toCLOSEIn this change I ensure that
stateis checked within a lock and reduced some of the excess assertions when setting the cursor.