-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Critical - P2
-
None
-
Component/s: Sessions
-
None
-
Needed
The following code will throw an error when using the node driver:
const cursor = coll.find(); while (await cursor.hasNext()) { const doc = await cursor.next(); await processDocForAnAccidentallyLongTime(doc); }
The reason is that the implicit session created when executing the initial find query controls the lifetime of the resulting cursor, and that session is automatically cleaned up after the logicalSessionsTimeoutMinutes (30 by default). When the user enters the second loop in the above example, they are confronted with an unhelpful "cursor id 124353857892752 does not exist" and then need to go learn a lot about how sessions work in MongoDB (they probably didn't even know an implicit session was created for them in the first place).
SPEC-1268 proposed that we add new drivers API for users to explicitly refresh their long-lived sessions, but this ticket proposes that we periodically send refreshSessions internally for active, long-lived cursors.
- is related to
-
PYTHON-1879 no_cursor_timeout not functioning as expected
- Closed
-
RUBY-1503 still having problems with noCursorTimeout
- Closed
-
SERVER-6036 Disable cursor timeout for cursors that belong to a session
- Closed
- links to