[GODRIVER-716] SessionContext not being goroutine safe is awkward Created: 17/Dec/18  Updated: 11/Oct/23  Resolved: 24/Jul/20

Status: Closed
Project: Go Driver
Component/s: CRUD
Affects Version/s: 0.1.0
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: Kristofer Brandow (Inactive) Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to GODRIVER-704 Document that mongo.SessionContext is... Closed
is related to GODRIVER-3011 Docs around SessionContext and parall... Scheduled

 Description   

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.


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