Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2730

Fix possible deadlock when recovering panic in "Server.update"

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.12.0, 1.11.3
    • Affects Version/s: None
    • Component/s: None
    • None
    • Not Needed
    • Hide

      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?

      Show
      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?

      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.

            Assignee:
            qingyang.hu@mongodb.com Qingyang Hu
            Reporter:
            matt.dale@mongodb.com Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: