This objToIndex BSONObj is pointing to a cursor, which can be saved/restored and no longer save the data to which objToIndex points. Save/restore was exercised further down the stack, because we were running a createIndex command on two indexes at once, so this loop further down the stack with a reference to objToIndex can hit a WCE, save/restore the cursor, and then keep trying to use the now invalid objToIndex/doc BSONObj for the second index.
Recommendations: call getOwned() to assign a copy in objToIndex; or, update the objToIndex reference in the same lambda that restores the cursor.
- is caused by
-
SERVER-57737 The index builds code path can throw WCEs and invalidate an active cursor by calling abandonSnapshot without calling save/restore cursor.
- Closed