[SERVER-8612] Windows sockets overflow fd_set Created: 19/Feb/13  Updated: 11/Jul/16  Resolved: 21/Feb/13

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: 2.4.0-rc0
Fix Version/s: 2.4.0-rc1

Type: Bug Priority: Critical - P2
Reporter: Eric Milkie Assignee: Eric Milkie
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows


Issue Links:
Related
related to SERVER-23338 ListeningSockets::closeAll should not... Closed
Operating System: Windows
Participants:

 Description   

On Windows, I set FD_SETSIZE to 1024. However, this is not large enough, and it's hard to say how large we need to set it other than going with 32767. The socket() function does not necessarily return numbers in sequential order like on Unix.
We could use WSAPoll() but this function is not supported on XP.
We could use accept() but we would need a different way to update the listen timer.



 Comments   
Comment by auto [ 26/Feb/13 ]

Author:

{u'date': u'2013-02-22T10:07:30Z', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}

Message: SERVER-8612 Fix typo
Branch: master
https://github.com/mongodb/mongo/commit/4a39a5bcbb2c298432819e66febab717e2c67b1a

Comment by auto [ 21/Feb/13 ]

Author:

{u'date': u'2013-02-15T14:46:25Z', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-8612 alternative select() implementation for Windows

On Windows, socket() can return any SOCKET value, not just a small, incrementing
number. This makes it very hard to use select() since you need to allocate an
enormous fd_set to cover all the possible SOCKET values.
Instead, I've rewritten the listen/accept logic on Windows to avoid calling
select(); instead, we make use of Winsock2 native API calls.
Branch: master
https://github.com/mongodb/mongo/commit/bf97961c885fc02feecb3bc45bd1f52e23b3d1b8

Comment by Eric Milkie [ 19/Feb/13 ]

Going to try using AcceptEx() and WaitForSingleObject(), which should be supported on all Windowses.

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