[GODRIVER-2423] WaitQueueTimeoutError reports pinned connections when no pinning occurs Created: 16/May/22  Updated: 08/Nov/23  Resolved: 29/Aug/23

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

Type: Bug Priority: Unknown
Reporter: Kevin Albertson Assignee: Qingyang Hu
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Quarter: FY24Q3
Documentation Changes: Not Needed
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   

Scope

  • Do not include the "connections in use by cursors: x, connections in use by transactions: y, connections in use by other operations: z" part of the WaitQueueTimeoutError when connections are not being pinned.

Background & Motivation

When connected to a Load Balancers, drivers are required to pin connections to cursors and transactions.
Drivers are required to report the pinned connections in the WaitQueueTimeoutError.

The Go driver always reports pinned connections in WaitQueueTimeoutError, even if no connection pinning occurs.

That can cause confusing error messages when not connected to a load balanced cluster. Example:

timed out while checking out a connection from connection pool: context canceled; maxPoolSize: 300, connections in use by cursors: 0, connections in use by transactions: 0, connections in use by other operations: 0



 Comments   
Comment by Githook User [ 08/Nov/23 ]

Author:

{'name': 'Qingyang Hu', 'email': '103950869+qingyang-hu@users.noreply.github.com', 'username': 'qingyang-hu'}

Message: GODRIVER-2423 Include pinned connections in WaitQueueTimeoutError only for load balanced clusters. (#1353)
Branch: release/1.12
https://github.com/mongodb/mongo-go-driver/commit/43ccd6876b6500c8234cac0bd6c4146427ca8897

Comment by Githook User [ 29/Aug/23 ]

Author:

{'name': 'Qingyang Hu', 'email': '103950869+qingyang-hu@users.noreply.github.com', 'username': 'qingyang-hu'}

Message: GODRIVER-2423 Include pinned connections in WaitQueueTimeoutError only for load balanced clusters. (#1353)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/d71481e770066f86bf7ee4fb5baf0b1bae7d1a4d

Comment by Matt Dale [ 03/Aug/23 ]

Ways this error could be better:

  • The messaging for total connections uses the description "connections in use by other operations", which can be misleading in some circumstances. It would be better to just describe it as "open connections".
  • Maybe add an "idle connections" count as well, although that will probably always be 0. (use pool.availableConnectionCount)
  • Maybe add a "wait duration" value, which is the time spent waiting for a connection. That could be helpful when troubleshooting problems where it's not clear how long each operation phase (server selection, pool checkout, round trip, etc) took.

Ways to improve pinned cursors info:

  1. Omit the information about pinned connections if the counts are 0. That's probably good enough to resolve confusion in most cases, but isn't as explicit when the driver is pinning connections but there happen to be 0 pinned.
  2. Keep track of if any connection has ever been pinned for any reason, and enable pinned connection reporting if so. The main downside is an extra code to maintain.
    E.g.

    var hasPinnedToCursor sync.Bool
     
    func (p *pool) pinConnectionToCursor() {
        hasPinnedToCursor.Store(true)
        // ...
    }
    

I think #1 is probably good enough and simpler, but either works.

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