[Live-devel] filedescriptor leak on windows plateform

PROMONET Michel michel.promonet at thalesgroup.com
Mon May 26 05:34:55 PDT 2014


  Hi Ross,

With a colleage we saw a filedescriptor leak in somethink that looks like a workaround for windows.

In BasicTaskScheduler.cpp there is :
#if defined(__WIN32__) || defined(_WIN32)
    int err = WSAGetLastError();
    // For some unknown reason, select() in Windoze sometimes fails with WSAEINVAL if
    // it was called with no entries set in "readSet".  If this happens, ignore it:
    if (err == WSAEINVAL && readSet.fd_count == 0) {
      err = EINTR;
      // To stop this from happening again, create a dummy socket:
      int dummySocketNum = socket(AF_INET, SOCK_DGRAM, 0);
      FD_SET((unsigned)dummySocketNum, &fReadSet);
    }
    if (err != EINTR) {
#else

But the dummySocket is never closed.

As during the lifetime of the process we can create/destroy many TaskScheduler, this small leak becomes important.
Do you think it could be safe to add a close(dummySocketNum) ?

Best Regards,

  Michel.


More information about the live-devel mailing list