[GODRIVER-1323] Cleanup connection close logic Created: 26/Sep/19  Updated: 28/Oct/23  Resolved: 03/Oct/19

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

Type: Bug Priority: Major - P3
Reporter: Divjot Arora (Inactive) Assignee: Isabella Siu (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related

 Description   

For the topology.Connection type, we release the server's semaphore in the Close and Expire methods, but only set the underlying connection to nil if there are no errors. This could lead to a semaphore being released too many times if the following happens:

1. Close is called. Semaphore is released once but there is an error putting the connection back in the pool, so the underlying connection is not set to nil.

2. Close is called again. The semaphore is released again, causing a panic.

To fix this, we should move the line that sets connection to nil higher up so that it always happens and avoids a panic.



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

Author:

{'username': 'iwysiu', 'email': 'isabella.siu@10gen.com', 'name': 'iwysiu'}

Message: GODRIVER-1323 cleanup connection close logic (#183)
Branch: release/1.1
https://github.com/mongodb/mongo-go-driver/commit/41757403a1c1ac96fcfbf3e11926eee128e7785e

Comment by Githook User [ 03/Oct/19 ]

Author:

{'name': 'iwysiu', 'username': 'iwysiu', 'email': 'isabella.siu@10gen.com'}

Message: GODRIVER-1323 cleanup connection close logic (#183)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/959ab5a776dc6ad9bdb179ecba2b35d08b898dae

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