[SERVER-35031] ExceededTimeLimit (50) is reported in situations unrelated to maxTimeMS Created: 16/May/18  Updated: 29/Oct/23  Resolved: 24/Jul/18

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 4.0.1, 4.1.2

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: James Wahlin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Problem/Incident
Related
related to SERVER-36868 Update error code in the stepdown hook. Closed
Backwards Compatibility: Minor Change
Backport Requested:
v4.0, v3.6, v3.4
Sprint: Query 2018-07-30
Participants:
Linked BF Score: 22

 Description   

The original drivers specification for maxTimeMS required that:

In languages that have exceptions, drivers will declare a new exception type ExecutionTimeout. This new exception is raised when the driver detects the server error code 50 in the server's response to a query, getMore, or command.

However, since then error code 50 (ExceededTimeLimit) has been re-used by the server to report errors unrelated to maxTimeMS.  This confuses application authors when they receive an ExecutionTimeout exception when they haven't specified maxTimeMS.

I'm not sure it's possible, but it would be beneficial to users if the server stopped using error code 50 for anything but maxTimeMS-related timeouts.



 Comments   
Comment by Githook User [ 27/Jul/18 ]

Author:

{'username': 'jameswahlin', 'name': 'James Wahlin', 'email': 'james@mongodb.com'}

Message: SERVER-35031 Return MaxTimeMSExpired for maxTimeMS timeout

Adds a new 'MaxTimeMSExpired' error code, returned when a timeout occurs
due to exceeding of maxTimeMS. Timeouts unrelated to maxTimeMS will
continue to return 'ExceededTimeLimit'.

(cherry picked from commit 35528523c00b72a210dc5b78a427d90ed1c14331)
Branch: v4.0
https://github.com/mongodb/mongo/commit/54f1582fc6eb01de4d4c42f26fc133e623f065fb

Comment by Ian Whalen (Inactive) [ 27/Jul/18 ]

jeff.yemin the plan is to backport this to 4.0 ASAP and let it burn in for a while before backporting to 3.6 and 3.4.

Comment by Githook User [ 24/Jul/18 ]

Author:

{'name': 'James Wahlin', 'email': 'james@mongodb.com', 'username': 'jameswahlin'}

Message: SERVER-35031 Return MaxTimeMSExpired for maxTimeMS timeout

Adds a new 'MaxTimeMSExpired' error code, returned when a timeout occurs
due to exceeding of maxTimeMS. Timeouts unrelated to maxTimeMS will
continue to return 'ExceededTimeLimit'.
Branch: master
https://github.com/mongodb/mongo/commit/35528523c00b72a210dc5b78a427d90ed1c14331

Comment by Jeffrey Yemin [ 22/Jun/18 ]

ian.whalen I can confirm that.

Comment by Ian Whalen (Inactive) [ 22/Jun/18 ]

Whoever picks this up needs to confirm with Drivers that they only rely on the numeric error code, not on the name 'exceededtimelimit'.

Comment by David Storch [ 20/Jun/18 ]

A quick search turns up 46 uses of ExceededTimeLimit in the master branch, excluding tests, as of c6b10c46cce635574297577f75f57b792b508893:

➜  mongo git:(master) ✗ git grep -w "ExceededTimeLimit" src/ | grep -v "test.cpp" | grep -v "dbtests" | wc -l
46

Of these, many seem to be legitimate uses of ExceededTimeLimit for the implementation of maxTimeMS. However, there are quite a few uses that are unrelated to maxTimeMS:

src/mongo/client/connpool.cpp:        uassert(ErrorCodes::ExceededTimeLimit,
src/mongo/db/keys_collection_manager.cpp:        uasserted(ErrorCodes::ExceededTimeLimit, "timed out waiting for refresh");
src/mongo/db/keys_collection_manager.h:     * Throws ErrorCode::ExceededTimeLimit if it times out.
src/mongo/db/keys_collection_manager.h:     * Throws ErrorCode::ExceededTimeLimit if it times out.
src/mongo/db/repl/replication_coordinator_impl.cpp:        return Status(ErrorCodes::ExceededTimeLimit,
src/mongo/db/repl/replication_coordinator_impl.cpp:        return Status(ErrorCodes::ExceededTimeLimit,
src/mongo/db/repl/replication_coordinator_impl.cpp:        return {ErrorCodes::ExceededTimeLimit,
src/mongo/db/repl/replication_coordinator_impl.cpp:            // attemptStepDown again will cause attemptStepDown to return ExceededTimeLimit with
src/mongo/db/repl/topology_coordinator.cpp:        uasserted(ErrorCodes::ExceededTimeLimit,
src/mongo/db/repl/topology_coordinator.cpp:            uasserted(ErrorCodes::ExceededTimeLimit,
...

Assuming we do the following:

  1. Rename error code 50 to MaxTimeMSExpired.
  2. Introduce a new error code for generic ExceededTimeLimit.
  3. Review all uses of ExceededTimeLimit and change them as needed to MaxTimeMSExpired.

I estimate that this could be completed with one full day of work.

Comment by Ian Whalen (Inactive) [ 01/Jun/18 ]

need to investigate how many call sites there are for this (and thus how much work here).

Generated at Thu Feb 08 04:38:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.