[SERVER-9109] initAndListen returns on ECONNABORTED Created: 24/Mar/13  Updated: 11/Jul/16  Resolved: 09/Sep/13

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 2.4.7, 2.5.3

Type: Bug Priority: Major - P3
Reporter: Andre de Frere Assignee: Matt Dannenberg
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
Operating System: ALL
Participants:

 Description   
Issue Status as of December 5th, 2013

ISSUE SUMMARY
The ECONNABORTED error is non-fatal, but it will return; from the loop in initAndListen when ECONNABORTED is detected. It could be better to log this and continue the loop under these conditions.

USER IMPACT
mongod could give up on listening to a port when mongod doesn't have to, effectively closing the server when mongod doesn't need to.

It is present in versions of MongoDB prior to and including v2.4.6.

SOLUTION
continue; rather than return; on ECONNABORTED.

WORKAROUNDS
None.

PATCHES
Production release v2.4.7 contains the fix for this issue, and production release v2.6.0 will contain the fix as well.

The ECONNABORTED error is non-fatal, but it will return; from the loop in initAndListen when ECONNABORTED is detected. It could be better to log this and continue the loop under these conditions.

Found in a couple of places in listen.cpp, depending on the OS:
https://github.com/mongodb/mongo/blob/master/src/mongo/util/net/listen.cpp#L266
https://github.com/mongodb/mongo/blob/master/src/mongo/util/net/listen.cpp#L465



 Comments   
Comment by Leonid Evdokimov [ 09/Dec/13 ]

FYI, here is scapy script I used to trigger the issue: https://gist.github.com/darkk/7869676

Comment by auto [ 02/Oct/13 ]

Author:

{u'username': u'dannenberg', u'name': u'matt dannenberg', u'email': u'matt.dannenberg@10gen.com'}

Message: SERVER-9109 continue rather than return on ECONNABORTED and EBADF
Branch: v2.4
https://github.com/mongodb/mongo/commit/bd96977507f3b45f2fafb3f8b8c3299948e5899c

Comment by Leonid Evdokimov [ 17/Sep/13 ]

Is the fix backported to 2.4 and 2.2?
As far as I see, this bug can lead to remote DoS attack if tcp port is not secured with firewall.

Comment by auto [ 09/Sep/13 ]

Author:

{u'username': u'dannenberg', u'name': u'matt dannenberg', u'email': u'matt.dannenberg@10gen.com'}

Message: SERVER-9109 continue rather than return on ECONNABORTED and EBADF
Branch: master
https://github.com/mongodb/mongo/commit/59eaedfdb43c1765ba91aa2c78dfc54de4844bb3

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