[CSHARP-4409] Add missing MaxTimeMs to query options Created: 10/Nov/22  Updated: 27/Oct/23  Resolved: 07/Dec/22

Status: Closed
Project: C# Driver
Component/s: API
Affects Version/s: 2.18.0
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Markus Eggimann Assignee: James Kovacs
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates DRIVERS-797 Support maxTimeMS for write operations Closed
Related
related to CSHARP-3393 Client Side Operations Timeout Backlog

 Description   

MongoDB supports server side timeout (MaxTimeMs) for nearly all queries.

However, the corresponding configuration property is missing on certain option classes:

  • BulkWriteOptions
  • DeleteOptions
  • InsertManyOptions
  • InsertOneOptions
  • ReplaceOptions
  • UpdateOptions

There might be other properties be missing on those commands.

Please add the MaxTimeMs (and probably other missing properties) to the options.

 



 Comments   
Comment by PM Bot [ 07/Dec/22 ]

There hasn't been any recent activity on this ticket, so we're resolving it. Thanks for reaching out! Please feel free to comment on this if you're able to provide more information.

Comment by James Kovacs [ 23/Nov/22 ]

Hi, mongodb.com-account@jean-richard.ch,

CSHARP-3393 is a non-trivial amount of work based on our implementations in other driver languages. While we intend to implement support in all our drivers in the coming quarters, we don't have an availability estimate for the .NET/C# Driver yet.

Using socketTimeoutMS is definitely a potential workaround in the meantime. If you're running MongoDB 4.2 or later, the server supports socket liveness checking, which will terminate certain inflight operations when the remote client has hung up. See Client Disconnection in the 4.2 release notes and SERVER-39150 for more information. This should help mitigate the cost of the retry as the original unresponsive long-running operation should be terminated automatically.

Sincerely,
James

Comment by Meinrad Jean-Richard [ 21/Nov/22 ]

Hi James,

 

Thanks for your response. Do you have any idea as to when we can expect that feature? For us this is a serious problem in our current deployment. We currently have some operations that take longer than our clientside (socket) timeout. When that timeout expires we usually retry and this makes the DB even slower (basically we start a denial-of-service attack on our own db). Is there any way to work around this issue until the feature you mention is available?

 

Thanks,

Meinrad

Comment by James Kovacs [ 15/Nov/22 ]

Hi, meggima.github@outlook.com,

Thank you for reaching out to us about this omission in our API. This is a known gap, which is tracked in DRIVERS-797. We appreciate the offer to assist with a PR and in general we would be accepting of such a PR. We have however decided to implement a more general mechanism called Client Side Operation Timeout (AKA CSOT), which will utilize maxTimeMS behind the scenes rather than exposing it directly to users.

With CSOT, you specify the total operation time before your application needs a response. This timeout applies to all of the work done to execute the operation, including but not limited to server selection, connection checkout, and server-side execution. Behind the scenes, a calculated maxTimeMS will be applied to operations based on the time remaining.

CSOT has already been implemented in the Go (GODRIVER-1885) and Python Drivers (PYTHON-2550). It is being implemented in our other drivers in the coming months. The .NET/C# implementation of CSOT is tracked in CSHARP-3393.

Please let us know if you have any questions.

Sincerely,
James

Comment by Markus Eggimann [ 10/Nov/22 ]

We would be willing to help with this. Would you accept a PR?

Generated at Wed Feb 07 21:48:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.