[GODRIVER-2669] Getting a connection from the pool is returning context.Cancelled instead of DeadlineExceeded Created: 01/Dec/22  Updated: 27/Oct/23  Resolved: 09/Mar/23

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Tyler Kaye Assignee: Preston Vasquez
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to GODRIVER-3021 Document connection pool timeout causes Backlog
Quarter: FY24Q1
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

We are seeing the following error in splunk:

error incrementing server version counter: timed out while checking out a connection from connection pool: context canceled; maxPoolSize: 40, connections in use by cursors: 0, connections in use by transactions: 0, connections in use by other operations: 40 (ProtocolErrorCode=201)

This is for BAAS / App Services / Device Sync. There is a ton of code that we use to interface with the driver and that makes this difficult to provide a whole lot of useful information without just dumping way too much information but the summary is:
1. I am fairly certain we are not cancelling the context but it could theoretically be possible (I just would expect to see other messages if this were the case)
2. The context we pass in has a deadline of 4 minutes
3. This is happening after exactly 30 seconds

Discussion from slack:

From Benji:
That’s a WaitQueueTimeoutError that is returned during connection check out when the context is done. It wraps the underlying context error. Does the context you’re using to run operations have any sort of deadline/is there any chance you’re cancelling it within your application? Can you share the code for “incrementing server version counter”?

From Preston:
To add to Benji’s answer, it looks like this is CSOT timeout logic which uses the “context.CancelFunc” defined for “context.WithoutTimeout”. The code for that in the Go Driver is here.

https://github.com/mongodb/mongo-go-driver/blob/master/x/mongo/driver/operation.go#L338

This is not a huge issue for us but it is lightly puzzling. If you need more information please let me know and I apologize I cant provide much more detail now



 Comments   
Comment by Tyler Kaye [ 09/Mar/23 ]

Hi, I appreciate the effort and thought put into your response. As this is not a big issue on our end, rather just something I wanted to flag and make sure there wasnt a simple issue hiding in the code, I will close this out.

Thanks,
Tyler

Comment by PM Bot [ 09/Mar/23 ]

Hey tyler.kaye@mongodb.com, We need additional details to investigate the problem. If this is still an issue for you, please provide the requested information.

Generated at Thu Feb 08 08:39:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.