[CSHARP-1798] MongoConnection.Close() should always call TcpClient.Close() Created: 12/Oct/16 Updated: 29/Oct/17 Resolved: 29/Oct/17 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Connectivity |
| Affects Version/s: | 1.11 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Andrew Young | Assignee: | Robert Stam |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Case: | (copied to CRM) |
| Description |
|
TcpClient creates a socket when the TcpClient is first constructed but doesn't open it right away. So it might be possible for a disconnected TcpClient to hold on to an ephemeral port even though it's not connected. Because of this, MongoConnection.Close() should always call TcpClient.Close(). |
| Comments |
| Comment by Robert Stam [ 29/Oct/17 ] | ||||||||||||||||||||||||||||||||||
|
The 1.x versions are no longer under development. The 2.x versions no longer use TcpClient so are not affected by this issue. | ||||||||||||||||||||||||||||||||||
| Comment by Andrew Young [ 12/Oct/16 ] | ||||||||||||||||||||||||||||||||||
|
Email from Microsoft regarding the issue: This is the area of concern inside Mongo driver:
This is MongoConnection.Close() code. Note this is calling TcpClient.Close() ONLY if TcpClient is Connected…. Otherwise, it’ll just null it out – which then would end up with TcpClient on Finalizer queue. |