[zeromq-dev] zmq_recv not blocking on linux
Alain Rastoul
alf.mmm.cat at gmail.com
Thu Nov 6 08:05:11 CET 2014
Le 05/11/2014 20:52, Alain Rastoul a écrit :
> Hi,
>
> I translated the Hello World client/server sample of the zeroMQ guide
> to Pharo smalltalk and have a very different behaviour on windows and on
> Linux.
> ZeroMQ versions I use are 4.0.4 on windows and 4.0.5 on linux.
> On windows, the zmq_recv call of the server is blocking as expected,
> and everything is ok (client and server) but on
> Linux zmq_recv is not blocking and returns EAGAIN several times, then
> finally EINTR
> (of course I specify blocking mode for zmq_recv).
> The C version is working as expected on linux, so I wonder myself if
> something
> done by the smalltalk VM could put the TCP stack in a state that newly
> created sockets
> are in non blocking mode ? A TCP setting ?
> Or something related to threads (green threads ?), but in this case
> why is the C version working (the libraries are the same) ?
>
> Any advice or comments are welcome,
>
> Thanks in advance
>
> Regards,
>
> Alain
>
Debugging both, I think it has nothing to do with socket state,
the machine state with receive poller thread makes it quite
complicated, and I certainly miss something for now, but
I wonder why in event poller thread :
...
while (!stopping) {
// Execute any due timers.
int timeout = (int) execute_timers ();
// Wait for events.
int n = epoll_wait (epoll_fd, &ev_buf [0], max_io_events,
timeout ? timeout : -1);
if (n == -1) {
errno_assert (errno == EINTR);
continue;
}
the timeout to epoll_wait is 0 when there is no timer ?
shouldn't it be -1 or shouldn't it be some timer set ?
More information about the zeromq-dev
mailing list