[GODRIVER-2730] Fix possible deadlock when recovering panic in "Server.update" Created: 10/Jan/23  Updated: 28/Oct/23  Resolved: 13/Mar/23

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.12.0, 1.11.3

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

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   

The server heartbeat goroutine (Server.update) uses a "defer recover" block that catches any panics that happen during heartbeats. That "defer recover" block uses a blocking channel receive to prevent the Server.update call from exiting until Server.Disconnect is called (see code here). If a panic does happen, that blocking channel receive can result in a deadlock when the application is shutting down. Remove the channel receive to prevent a deadlock while shutting down.

Definition of done:

  • Remove the blocking channel receive in the "defer recover" block in Server.update.


 Comments   
Comment by Githook User [ 17/Mar/23 ]

Author:

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

Message: GODRIVER-2730 Remove blocking channel in update recovering. (#1196)
Branch: release/1.11
https://github.com/mongodb/mongo-go-driver/commit/53b68156c6e2369e40af4c70aa1ea3b2c4664c3d

Comment by Githook User [ 13/Mar/23 ]

Author:

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

Message: GODRIVER-2730 Remove blocking channel in update recovering. (#1196)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/48a21dbbcc3311297d503f0339f69704bdd07a2b

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