[GODRIVER-1663] Context pinned by connection.connect Created: 22/Jun/20  Updated: 28/Oct/23  Resolved: 02/Jul/20

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

Type: Bug Priority: Major - P3
Reporter: Divjot Arora (Inactive) Assignee: Kriti Ravindran (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related

 Description   

The connection.connect function wraps the supplied context using context.WithCancel and stores the returned cancellation function so we can abort connection establishment. We need to ensure we call that function in a defer after connect finishes and also set it to nil because the cancellation function holds a reference to the context, which pins all of the memory that the context has stored.

This will require a mutex for syncrhonization because the cancellation function is accessed by both the connect and closeConnectContext functions.



 Comments   
Comment by Githook User [ 02/Jul/20 ]

Author:

{'name': 'Kriti Ravindran', 'email': 'kriti.ravindran@mongodb.com', 'username': 'KritiRav'}

Message: GODRIVER-1663 setting cancelConext to nil to avoid context being pinned (#436)
Branch: release/1.3
https://github.com/mongodb/mongo-go-driver/commit/9c88c8cb5b4f739dd473fd2bde175bf371f7747a

Comment by Githook User [ 02/Jul/20 ]

Author:

{'name': 'Kriti Ravindran', 'email': 'kriti.ravindran@mongodb.com', 'username': 'KritiRav'}

Message: GODRIVER-1663 setting cancelConext to nil to avoid context being pinned (#436)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/d4fe3756668f6dd3af97fa67c082d9cb7fc6f094

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