Make the GridFS API goroutine-safe

XMLWordPrintableJSON

    • Type: Epic
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • GridFS goroutine-safe
    • Go Drivers
    • 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?
    • To Do
    • 0
    • 0
    • 0
    • 100
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      Currently some Go Driver GridFS API methods are not goroutine-safe. While we don't explicitly document that the GridFS API is goroutine safe, it's surprising to users because the Go Driver CRUD API is goroutine-safe and there's no technical reason that the GridFS API shouldn't be goroutine-safe.

      In the best case, like what happened in GODRIVER-3841, users detect that the GridFS methods are not goroutine-safe and use them strictly serially. In the worst case, users call the GridFS methods concurrently and nothing bad happens most of the time, but it causes intermittent errors, possibly data corruption (although we haven't directly observed data corruption).

      Motivation

      Who is the affected end user?

      Developers using the Go Driver to build applications that use the GridFS API.

      How does this affect the end user?

      They either see Go data race detector test failures, or they experience intermittent errors. There's a possibility of data corruption, but it hasn't directly been observed.

      How likely is it that this problem or use case will occur?

      Currently the problem happens when multiple concurrent upload requests try to create the GridFS collections and indexes, which is guarded in the Go Driver with a non-atomically-accessed boolean. The probability of that happening depends on the call pattern, but it's relatively low.

      The probability of users detecting the issue with the Go data race detector is much higher.

      If the problem does occur, what are the consequences and how severe are they?

      • Go data race detector failures in tests
      • Intermittent errors returned by the GridFS API
      • Possibly data corruption, although that's never been observed.

      Is this issue urgent?

      No. We don't guarantee that the GridFS API is goroutine-safe, although it's reasonable to assume that it is. We've received one recent user report about lack of goroutine safety.

      Is this ticket required by a downstream team?

      No.

      Is this ticket only for tests?

      No.

      Cast of Characters

      Engineering Lead:
      Document Author:
      POCers:
      Product Owner:
      Program Manager:
      Stakeholders:

      Channels & Docs

      Slack Channel

      [Scope Document|some.url]

      [Technical Design Document|some.url]

            Assignee:
            Unassigned
            Reporter:
            Matt Dale
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              None
              None
              None
              None
              None
              None