[GODRIVER-1609] ConnectionClosed events not published when pool is disconnecting Created: 08/May/20 Updated: 28/Oct/23 Resolved: 07/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: | Divjot Arora (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
In pool.go, ConnectionClosed events are published in the expiration-checking function and in disconnect for forcefully-closed connections. This doesn't cover all cases though, because connections closed gracefully during disconnect don't go through the expiration checker and connections that encounter network errors manually call pool.removeConnnection on themselves. We can move the event-firing to closeConnection and removeConnection because all cases go through one of those. We'll have to store the reason for closing (e.g. idle, pool closing, etc) on the connection so the event can be published correctly.
The timer variable in pool.disconnect is incorrect. It calculates the time to fire as now-contextDeadline, which will be negative if the deadline is in the future. I don't know why that timer is there at all. I think the ctx.Done() + ticker cases cover everything we need. |
| Comments |
| Comment by Githook User [ 07/Jul/20 ] |
|
Author: {'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com', 'username': 'divjotarora'}Message: |
| Comment by Githook User [ 07/Jul/20 ] |
|
Author: {'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com', 'username': 'divjotarora'}Message: |