Hi Nick, thanks for the feedback. The alternative is for the close() to happen in the "finalize > callback" that happens from the main thread in the new 0., and make > sure that happens after the event_del calls have had their effect. > > I think this sounds like the right approach for closing socket descriptors; in general I'm more comfortable when resource deallocation is happening in a single-threaded context. What's more, I don't think that we should try to fix this issue by looping the select, as EBADF (or its WSA equivalent) is probably not a benign error message in most cases, but indication of a programming error.
I do think that checking each of the backends for other non-zero non-error codes and looping on those is a good idea (as already done with EINTR, for example). In my first message I mentioned WSAENETDOWN; internet chatter suggests that might happen occasionally when coming out of sleep and probably should not terminate the select-based event loop. > Any interest in helping to track this down? :) One thing that might > help is a little test program that tries to provoke this bug. Beyond > that, improving the finalize-callback code in the master branch would > also be of benefit. > > Yeah, I'd be happy to help. I have a test program that I can adapt and publish. I haven't been following the development of bufferevent finalization in 2.1 but I will start taking a look. Best, --nate
