[GODRIVER-1173] Add connected status to connection to avoid race conditions Created: 28/Jun/19  Updated: 28/Oct/23  Resolved: 01/Jul/19

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

Type: Improvement Priority: Major - P3
Reporter: Divjot Arora (Inactive) 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

 Description   

If Disconnect is called without a deadline while a connection is still checked out, we will aggressively close connections, which involves setting the underlying net.Conn to nil. This can cause a race condition if the checked out connection is in the middle of a network read.

We can fix this by adding a atomic int32 status to the connection type to test if a connection is open/closed instead of checking if c.nc == nil.



 Comments   
Comment by Githook User [ 03/Jul/19 ]

Author:

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

Message: Revendor driver for GODRIVER-1173
Branch: master
https://github.com/mongodb/mongo-tools-common/commit/c766505dab5850697619aa45342863d6c763f82f

Comment by Githook User [ 01/Jul/19 ]

Author:

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

Message: Add connected status to connection type.

GODRIVER-1173

Change-Id: I324fcba31c4065091a3449930fdbf88dc6b14afc
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/bab1629324fde2fccd78e20eb1267eac59b6a297

Comment by Divjot Arora (Inactive) [ 28/Jun/19 ]

cr: https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/459840

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