http://bugs.winehq.org/show_bug.cgi?id=10032
Summary: Wine must not use unix select() for networking where there might be high fd's Product: Wine Version: CVS/GIT Platform: Other OS/Version: other Status: NEW Keywords: patch Severity: normal Priority: P2 Component: wine-net AssignedTo: wine-bugs@winehq.org ReportedBy: dank@kegel.com
select() cannot handle fds higher than FD_SETSIZE. Thus if you open a lot of plain old files, then create one socket and try to use a networking function based on select(), you're hosed.
This actually happened recently during soak testing of an app doing lots of wininet stuff, which tickled a socket leak in wininet (see http://winehq.org/pipermail/wine-patches/2007-October/045089.html for the leak fix). This was a wake-up call for us; the app in question is fine after the leak fix, but an app that really used lots of file descriptors would hit the bug in a bad way.
Here's how to find all the suspicious calls to select(): $ find . -name '*.c' | xargs grep '[^a-z]select[^a-zA-Z]*(.*&' | grep -v '/tests/' Calls where select is used with no fd's are ok, since they can't run into the problem. Calls which use a winsock select() instead of a unix select() might be ok (e.g. netapi32/nbt.c), since winsock's select doesn't have a fixed FD_SETSIZE. Only two problematic calls remain:
wininet/internet.c: if (select(nSocket+1,&infd,NULL,NULL,&tv) > 0) wininet/netconnection.c: if (select(connection->socketFD+1,&infd,NULL,NULL,&tv) > 0)
These must be replaced with poll(), which can handle high fd's.
This was discussed last November, http://www.winehq.org/pipermail/wine-devel/2006-November/052099.html and Damjan submitted patches to fix them: http://www.winehq.org/pipermail/wine-patches/2006-November/032529.html http://www.winehq.org/pipermail/wine-patches/2006-November/032530.html but these patches don't seem to have been applied yet. Time to get them in!