Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2669

Getting a connection from the pool is returning context.Cancelled instead of DeadlineExceeded

    XMLWordPrintableJSON

Details

    • Icon: Question Question
    • Resolution: Gone away
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Hide

      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?

      Show
      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

      Attachments

        Activity

          People

            preston.vasquez@mongodb.com Preston Vasquez
            tyler.kaye@mongodb.com Tyler Kaye
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: