-
Type: Bug
-
Resolution: Fixed
-
Priority: Critical - P2
-
Affects Version/s: None
-
Component/s: None
-
None
-
Go Drivers
-
Not Needed
-
Detailed steps to reproduce the problem?
bucket.UploadFromStream and bucket.UploadFromStreamWithID will pre-maturely cancel a context if a client-level timeout is set since the latter method creates the context and defers cancelation.
func main() { opts := options.Client().SetTimeout(5 * time.Minute) client, err := mongo.Connect(opts) if err != nil { panic(err) } defer func() { _ = client.Disconnect(context.Background()) }() db := client.Database("test") bucket := db.GridFSBucket() var data bytes.Buffer for i := 0; i < 1e7; i++ { data.WriteString("some large stuff") } _, err = bucket.UploadFromStream(context.Background(), "huge_data", bytes.NewBuffer(data.Bytes())) if err != nil { log.Fatalf("failed to open upload stream: %v", err) } }
Definition of done: what must be done to consider the task complete?
Wrap a client-level timeout at the top of bucket.UploadFromStreamWithID:
ctx, cancel := csot.WithTimeout(ctx, b.db.client.timeout) efer cancel()
The exact Go version used, with patch level:
go version go1.22.6 darwin/arm64
The exact version of the Go driver used:
2.0.0-beta1
Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.
Local using drivers evergreen tools:
Current Mongosh Log ID: 66d0d4e6b992a7feb178097c Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.4 Using MongoDB: 8.1.0-alpha-3239-g1fde384 Using Mongosh: 2.2.4 mongosh 2.3.0 is available for download: https://www.mongodb.com/try/download/shell
The operating system and version (e.g. Windows 7, OSX 10.8, ...)
Sonoma 14.5
Security Vulnerabilities
NA
- is caused by
-
GODRIVER-2348 Make CSOT feature-gated behavior the default
- Closed
- is related to
-
GODRIVER-3330 Increase timeoutMS values in live CSOT prose tests
- Backlog
- related to
-
GODRIVER-3323 Implement CSOT Prose Tests
- Backlog
-
GODRIVER-3328 mtest should set failpoints on every node in sharded cluster
- Backlog