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

Improve panic handling in background processes

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 2.0.0, 1.14.0
    • Affects Version/s: None
    • Component/s: None
    • Major Change
    • 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?

      There is a mixture of defer recover blocks without a clear purpose and possibly unhandled panics in background goroutines in the Go driver (e.g. GODRIVER-2438). Improve the use of "defer recover" blocks in the Go driver to prevent recoverable panics from unnecessarily propagating, prevent hiding panics by exposing recovered panics, and add tests and documentation that exercise and describe the possible panic and recovery conditions.

      There are currently 3 "defer recover" blocks in the Go Driver that do not have a clear purpose or comment and discard the caught error. That means there are possibly panics happening in the Go Driver that are caught and ignored, increasing the risk of undiscovered driver bugs or unexpected behavior.

      Defer recover blocks and associated Github/Gerrithub history:

      All of that context doesn't provide any answers about why those defer recover blocks were added. The surrounding code has been changed significantly so they may no longer be necessary. A recent draft PR with the defer recover blocks removed passes all tests, but it's still possible the called code could panic due to some untested condition. We should collect more information about why the defer recover blocks were added, then remove them if possible.

      Definition of done:

      • Collect more historical context to understand why the defer recover blocks were added.
      • Add tests to cover any discovered untested panic conditions.
      • Add or move "defer recover" blocks that are necessary to handle panics in background goroutines. Include detailed comments describing what panic conditions we're expecting to handle.
      • Remove unnecessary "defer recover" blocks.
      • Fix any discovered panics that are bugs in the Go driver.

            Assignee:
            preston.vasquez@mongodb.com Preston Vasquez
            Reporter:
            matt.dale@mongodb.com Matt Dale
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: