[GODRIVER-1292] ListCollectionNames does not appear to close the cursor it creates Created: 02/Sep/19 Updated: 28/Oct/23 Resolved: 02/Oct/19 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | CRUD |
| Affects Version/s: | 1.1.0 |
| Fix Version/s: | 1.1.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Ryan Wynn | Assignee: | Alice Thum |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Description |
|
I might be missing something but it seems that res.Close(context.Background()) should be called within ListCollectionNames. The cursor is not returned to the caller in this case so I think it should be closed internally. If this function does need a cursor Close() call then special attention would need to be made to ensure the cursor is closed if an error is encountered while iterating the results. Currently, an error while iterating the results causes the function to immediately return the error. |
| Comments |
| Comment by Githook User [ 02/Oct/19 ] |
|
Author: {'name': 'Alice Thum', 'username': 'athum', 'email': 'ayhthum@gmail.com'}Message: Close cursor in Database.ListCollectionNames. Change-Id: I02c8765de132c1e8a8267c473a24fb9784d3e8fd |
| Comment by Githook User [ 02/Oct/19 ] |
|
Author: {'name': 'Alice Thum', 'username': 'athum', 'email': 'ayhthum@gmail.com'}Message: Close cursor in Database.ListCollectionNames. Change-Id: I02c8765de132c1e8a8267c473a24fb9784d3e8fd |
| Comment by Githook User [ 02/Oct/19 ] |
|
Author: {'username': 'athum', 'email': 'ayhthum@gmail.com', 'name': 'Alice Thum'}Message: Close cursor in Database.ListCollectionNames. Change-Id: I02c8765de132c1e8a8267c473a24fb9784d3e8fd |
| Comment by Alice Thum [ 01/Oct/19 ] |
|
CR: https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/470059 |
| Comment by Ryan Wynn [ 02/Sep/19 ] |
|
Actually, there is already a context, ctx, passed into the function, so maybe it should be closed as res.Close(ctx). |