[GODRIVER-1849] ErrWaitQueueTimeout should wrap context error Created: 22/Jan/21 Updated: 28/Oct/23 Resolved: 01/Feb/21 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.4.6 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Divjot Arora (Inactive) | Assignee: | Benji Rewis (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
When a request to acquire a semaphore in a connection pool returns an error, we return ErrWaitQueueTimeout here. However, this would only happen if the context has timed out or been cancelled, so the final user-facing error should wrap ctx.Err(). This would allow the user to do errors.Is(err, context.DeadlineExceeded) and also allow our mongo.IsTimeout() function to detect this case. We can't do this while also keeping the sentinel ErrWaitQueueTimeout value, but this is private API and users are likely not checking for it directly, so I propose we remove that error and instead introduce a new error type that wraps ctx.Err(), has an Unwrap method, and keeps the same message as ErrWaitQueueTimeout in case users are checking for substrings. |
| Comments |
| Comment by Kevin Albertson [ 11/Feb/21 ] |
|
Cherry-picked onto release/1.5 with https://github.com/mongodb/mongo-go-driver/commit/64d19e6d0fa964062883fa01441237c38ad7bf32 |
| Comment by Githook User [ 01/Feb/21 ] |
|
Author: {'name': 'Benjamin Rewis', 'email': 'benji.rewis@mongodb.com', 'username': 'benjirewis'}Message: |
| Comment by Githook User [ 01/Feb/21 ] |
|
Author: {'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}Message: |
| Comment by Benji Rewis (Inactive) [ 28/Jan/21 ] |