[GODRIVER-1439] Only close heartbeat connections after they're opened Created: 13/Dec/19  Updated: 28/Oct/23  Resolved: 17/Dec/19

Status: Closed
Project: Go Driver
Component/s: Connections
Affects Version/s: 1.1.3
Fix Version/s: 1.2.1, 1.1.4

Type: Bug Priority: Critical - P2
Reporter: Patrick Meredith Assignee: Divjot Arora (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
Related
related to GODRIVER-1442 Fix connection error handling in Proc... Closed
related to GODRIVER-2432 Improve panic handling in background ... Closed
Case:

 Description   

When mongod is started after a client using SSL, heartbeat connections never succeed. When SSL is not used, the heartbeats correctly pick up once mongod is ready to receive connections.

https://github.com/pmeredit/sqlproxy/tree/BI-2413

Is a branch of sqlproxy with a repro of this issue.

https://github.com/pmeredit/sqlproxy/blob/BI-2413/REPRO_README.txt

Describes how to run the repro.

 

EDIT: The root cause of this issue is that custom dialers return connections that appear to be non-nil but have a nil value due to the nil interface issue (https://golang.org/doc/faq#nil_error). In the heartbeat code, the driver should only call nc.Close if the branch that executes a heartbeat is taken (https://github.com/mongodb/mongo-go-driver/blob/master/x/mongo/driver/topology/server.go#L543).



 Comments   
Comment by Githook User [ 17/Dec/19 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com', 'username': 'divjotarora'}

Message: GODRIVER-1439 Only close connections for heartbeat errors (#261)
Branch: release/1.1
https://github.com/mongodb/mongo-go-driver/commit/5a263a721f0b21d1c5cccd4288b29e53987eb590

Comment by Githook User [ 17/Dec/19 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com', 'username': 'divjotarora'}

Message: GODRIVER-1439 Only close connections for heartbeat errors (#261)
Branch: release/1.2
https://github.com/mongodb/mongo-go-driver/commit/9ec31735693ac6bfe39c7e641ac9483561c95c09

Comment by Githook User [ 17/Dec/19 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com', 'username': 'divjotarora'}

Message: GODRIVER-1439 Only close connections for heartbeat errors (#261)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/d563ba36192e780d2f6a491e120a409eebf8b626

Comment by Divjot Arora (Inactive) [ 16/Dec/19 ]

PR for the documentation changes in the driver: https://github.com/mongodb/mongo-go-driver/pull/260

Comment by Jeffrey Yemin [ 16/Dec/19 ]
  1. Yes, we should fix this bug but, as discussed privately, let's open another JIRA issue to track this work.
  2. Agreed. I also wonder if the driver could check for a nil value (using reflection, I think?) in order to avoid the panic, since it seems to be a fairly common programming error for clients to make.
  3. BIC could add a test, too, I would imagine.
Generated at Thu Feb 08 08:36:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.