[SERVER-10678] Socket constructor should not throw when the provided FD is closed already. Created: 04/Sep/13  Updated: 11/Jul/16  Resolved: 04/Sep/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 2.5.2
Fix Version/s: 2.5.3

Type: Bug Priority: Major - P3
Reporter: Andy Schwerin Assignee: Andy Schwerin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

See the following for an example, on Windows:
http://buildlogs.mongodb.org/Windows%2064-bit/builds/5680/test/sharding/read_pref.js

In essence, there is a race between the Socket constructor and the networking stack. If the far side of a network connection disconnects between the return of the accept or connect OS calls and the completion of the Socket constructor which is passed the FD returned by those calls, the resolution of the local address on the socket will fail. Right now, this masserts(), but error handling in initAndListen is not prepared for an exception here. It would be acceptable in the current architecture to simply log a warning, and know that future operations on the socket will fail because it has been disconnected.



 Comments   
Comment by auto [ 04/Sep/13 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-10678 Log a warning but do not throw when unable to determine local address of a socket.
Branch: master
https://github.com/mongodb/mongo/commit/bb91efe5d1222ce57ec89429d0f5e5e89932f72a

Generated at Thu Feb 08 03:23:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.