views:

36

answers:

0

After we do a send(), the error that comes back is EWOULDBLOCK, so then we do a select() with a timeval structure with tv_sec = tv_usec = 0 which should return back immediately, but it doesn't, we are stuck in the select() call, and people have said that have waited over 2 mins, with it still being blocked in the select() call.

This is a TCP non-blocking socket.

Can anyone shed some light on why this is going on, and how we can prevent this blocking behavior? This is going on in OS X 10.6 & windows 7.

The kicker is, this only happens sometimes, all the other times, it works as expected.

The one person who has access to gdb, attached it, and this was seen.

0x929eb8da in select$DARWIN_EXTSN$NOCANCEL ()

0x92983d67 in select () ...

Ideas ?

code:

do
{
    struct timeval tv = { 0, 0 };

    FD_ZERO(&write_fds);
    for (i = 0; i < set->len; ++i)
    {
        if (set->fds[i])
        {
            const SOCKET fd = set->fds[i]->fd[SOCK_CONNECTION];
            FD_SET(fd, &write_fds);
        }
    }

    ret = select(maxfd + 1, NULL, &write_fds, NULL, &tv);

} while (ret == SOCKET_ERROR && getSockErr() == EINTR);

...