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

SessionContext not being goroutine safe is awkward

    • Type: Icon: New Feature New Feature
    • Resolution: Won't Do
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 0.1.0
    • Component/s: CRUD
    • Labels:
      None

      In Go, a context.Context is goroutine safe, and users expect this to be true. A mongo.SessionContext is not goroutine safe, even though it's used as a context.Context when being passed to methods. This causes confusion for users. Additionally, it is not clear to users that the context created by the WithSession function or UseSession* methods should not escape the scope of the closure.

      While it's likely to be usable by documenting that a mongo.SessionContext is not goroutine safe, it is likely that users will continue to attempt to use a mongo.SessionContext with goroutines, whether inside a closure or external to it.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: