[SERVER-23338] ListeningSockets::closeAll should not cause an invariant if we are not inShutdown Created: 24/Mar/16  Updated: 14/Apr/16  Resolved: 25/Mar/16

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: None
Fix Version/s: 3.3.4

Type: Bug Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-8612 Windows sockets overflow fd_set Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Run scoped_db_conn_test on Windows.

Sprint: Platforms 12 (04/01/16)
Participants:
Linked BF Score: 0

 Description   

On linux, if the listen socket is closed and we get an error from select, we just let the thread driving the Listener fall out of the loop in Listener::initAndListen:

https://github.com/mongodb/mongo/blob/c2b1e28fd15a4400cbb311057ef33a2120f1e6e2/src/mongo/util/net/listen.cpp#L290

But, on Windows, if we find that the listening socket has closed, we fassertFailed.

This means that on Windows, it is impossible to get the thread out of initAndListen without terminating the process via fassertFailed without first calling shutdown().

This makes it hard to write reasonable tests that need to use a listener, like scoped_db_conn_test. We can't call shutdown or shutdownNoTerminate because after that happens, we are always in a shutdown state and can't start a new listener.

The Windows version of initAndListen should work more like the non-windows version: if WSAEventSelect fails, and we are not in shutdown, log an error and let the thread return. If we are in shutdown, just return.

https://github.com/mongodb/mongo/blob/c2b1e28fd15a4400cbb311057ef33a2120f1e6e2/src/mongo/util/net/listen.cpp#L463



 Comments   
Comment by Githook User [ 25/Mar/16 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: SERVER-23338 Don't fassert down the process if the listen socket closes on Windows
Branch: master
https://github.com/mongodb/mongo/commit/4a38dcf183c1024b41f9d68b0ca8e2f885f1e669

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