Discussion:
select() issue in MinGW build
Tim Rühsen
2017-05-18 15:12:28 UTC
Permalink
Hi,

are there know issues with select() when build for MinGW ?

Code is basically:

FD_ZERO(&fdset);
FD_SET(fd, &fdset);

rd = &fdset;
wr = &fdset;

select (fd + 1, rd, wr, NULL, NULL);


Select() always immediately comes back with 0, WSAGetLastError() return
6 (WSA_INVALID_HANDLE). fd is a valid socket descriptor (value 5 in my
last test).

Currently discussed here:
https://gitlab.com/gnuwget/wget2/issues/212

I appreciate any help.


With Best Regards, Tim
Bruno Haible
2017-05-18 17:07:25 UTC
Permalink
Hi,
Post by Tim Rühsen
are there know issues with select() when build for MinGW ?
Yes.
1) In https://lists.gnu.org/archive/html/bug-gnulib/2016-12/msg00112.html
you can see that we have known test failures.
2) Gnulib's implementation of select() cannot look at the sockets at the
non-sockets (files and pipes) at once; therefore it uses an alternating
approach, which means that in the worst case, it can busy-loop.
3) I also recall that the case of pipes is not working 100% fine.

I wish someone who has time could look into it again...

Bruno
Bruno Haible
2017-05-18 17:15:17 UTC
Permalink
Post by Tim Rühsen
https://gitlab.com/gnuwget/wget2/issues/212
Note that 'wine' is *not* a supported platform for gnulib.

It is already time consuming enough to try to support mingw and MSVC.
Supporting 'wine' would mean to additionally deal with the bugs in 'wine'
(i.e. analyze them, provide workarounds, and report them to 'wine' upstream)
- with little benefit since end users of such builds use Windows.

Bruno
Tim Rühsen
2017-05-19 14:18:49 UTC
Permalink
Post by Bruno Haible
Post by Tim Rühsen
https://gitlab.com/gnuwget/wget2/issues/212
Note that 'wine' is *not* a supported platform for gnulib.
It is already time consuming enough to try to support mingw and MSVC.
Supporting 'wine' would mean to additionally deal with the bugs in 'wine'
(i.e. analyze them, provide workarounds, and report them to 'wine' upstream)
- with little benefit since end users of such builds use Windows.
Just for the record:

Since I would like to use MinGW + wine for CI testing, I just took a
look at select.c/rpl_select().

After adding a few printf lines, select() worked. This smelled like a
timing issue. A sleep of 10ms before select() also solved the issue for me.

With Best Regards, Tim
Post by Bruno Haible
Bruno
Loading...