[DOCS-11255] Document that 3.6 implicit sessions may cause noTimeout cursors to close while in use. Created: 24/Jan/18 Updated: 30/Oct/23 Resolved: 24/Feb/20 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | drivers, Server |
| Affects Version/s: | None |
| Fix Version/s: | Server_Docs_20231030 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Shane Harvey | Assignee: | Ravind Kumar (Inactive) |
| Resolution: | Done | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||
| Days since reply: | 3 years, 50 weeks, 2 days ago | ||||||||||||||||||||||||||||
| Epic Link: | DOCSP-1769 | ||||||||||||||||||||||||||||
| Description |
|
The following code will work on MongoDB 3.4. The cursor is created with the no timeout option and is left open on the server until the application closes it.
MongoDB 3.6 drivers will add an implicit session to every command. The find command will use a new session and again create a cursor with the no timeout option. However, that session will timeout after 30 minutes of inactivity and the cursor will be closed. Users that need the cursor timeout to exceed the session timeout will need to write code to periodically refresh the session. This will prevent the session (and cursor) from timing out:
I don't think this change has been documented yet. CC alyson.cabral Scope
|
| Comments |
| Comment by Githook User [ 24/Feb/20 ] |
|
Author: {'username': 'rkumar-mongo', 'name': 'Ravind Kumar', 'email': 'ravind.kumar@mongodb.com'}Message: |
| Comment by Githook User [ 24/Feb/20 ] |
|
Author: {'username': 'rkumar-mongo', 'name': 'Ravind Kumar', 'email': 'ravind.kumar@mongodb.com'}Message: |
| Comment by Githook User [ 24/Feb/20 ] |
|
Author: {'name': 'Ravind Kumar', 'username': 'rkumar-mongo', 'email': 'ravind.kumar@mongodb.com'}Message: |
| Comment by Githook User [ 24/Feb/20 ] |
|
Author: {'username': 'rkumar-mongo', 'name': 'Ravind Kumar', 'email': 'ravind.kumar@mongodb.com'}Message: |
| Comment by Ravind Kumar (Inactive) [ 06/Sep/19 ] |
|
As a small update, i'm currently poking around this and am considering two stages to this fixup: 1) note (for all cursor-related docs) that the sessionTImeout overrides noCursorTimeout, and to use refreshSessions + explicit sessions for all ops to prevent session timeout. 2) for ops issued outside of a session, a combination of currentOp ( to retrieve the lsid) and refreshsessions should work instead. 1 I can finish must faster than 2, which will require some testing to confirm my thoughts. |
| Comment by Ravind Kumar (Inactive) [ 05/Sep/19 ] |
|
alyson.cabral am I right in thinking that, for 3.6+, this means that any op that returns a cursor (find/agg in particular) can timeout after 30 minutes of session inactivity (no auth reresh) ? e.g. a user starts an agg op that takes more than 30 minutes to return, session timeout kills the cursor? If so then I think I'll have to call out this behavior in quite a few places. I'd also like to see if we can provide better guidance than 'run refreshSessions periodically for all open sessions'. |
| Comment by Nathan Leniz [ 05/Sep/19 ] |
|
ravind.kumar I had looked into it but if you have time, please feel free. |
| Comment by Ravind Kumar (Inactive) [ 05/Sep/19 ] |
|
nathan.leniz did you mean to assign this to yourself? If not I can take this to get it in the queue for this week. |
| Comment by Shane Harvey [ 05/Dec/18 ] |
|
Note that because of |
| Comment by Shane Harvey [ 25/Jan/18 ] |
|
25 minutes also makes sense. The main point is that the user needs to manually refresh the session before it times out on the server. |
| Comment by Asya Kamsky [ 24/Jan/18 ] |
|
Why 5 * 60? That's 5 minutes, right? Should be more like every 25 minutes, right? |
| Comment by Bernie Hackett [ 24/Jan/18 ] |
|
This behavior change should be documented in the release notes for 3.6, and in the docs for the find command. |