|Keep It Simple, Stupid|
Re^7: Does IO::Select work? (perfect)by tye (Sage)
|on Oct 23, 2012 at 17:35 UTC||Need Help??|
The bug report said that it happened, in one case, when he hit escape in the browser. So I doubt it was the kernel. It might not have been Perl or the script, either. It could be a non-kernel library. But the situation was described as and even sounds like it would be a situation where the script (which is what the programmer "has full control over") wasn't the software closing the socket. And the report says that there were other situations that caused the same problem.
That this violates your sensibilities is clear, but that seems poor justification for going on and on like this, just ignoring the evidence that contradicts that "the developer has full control over the lifespan of the socket". I agree that it is a bit unexpected and unfortunate that there are libraries of some kind that cause a socket to lose its file descriptor number.
But even if it turns out that it was a mistake on the part of the Perl script, then we just have a demonstration of it not being a trivial matter to find how the script is closing a socket unexpectedly. Debugging can be hard. I hope that isn't a surprise to you.
"In a perfect world" the programmer will have full control over the socket's fd's lifespan and will have no difficulty fixing when their control over the lifespan causes a fd to be closed other than the place where fds that are in the IO::Select object are managed. But we have clear evidence that the world isn't perfect.
The way IO::Select behaves in such a situation is terrible. It is trivial to fix it to at least complain when that situation happens. There is no excuse for silently doing stupid stuff in that situation, despite your many attempts to make excuses. It sounds like it isn't particularly hard to make it actually work well in that situation, so that fix should just be applied. This isn't a "just update the documentation" type of bug.
And in a perfect world, bugs in Perl and the kernel and all libraries will be fixed quickly and hardly anybody will be bothered by bugs so software doesn't need to take trivial steps to avoid silently doing stupid stuff when such a bug appears (especially when more than one case of such a bug was already reported in-the-wild).