in reply to Re^4: Does IO::Select work? (Problem partially resolved)
in thread Does IO::Select work? Anywhere?
then all I'd like to see is the description of situations where the kernel would close your file descriptor
The mistake you keep making is assuming that it must be the (a) OS kernel that is doing this.
Perl is perhaps a more likely target for responsibility. For example:
{ my $sock = new IO::Socket::INET( 'localhost:12345' ); } ## Here the handle is closed.
And:
for( 1 .. 2 ){ my $sock = new IO::Socket::INET( 'localhost:12345' ); } ## The first handle was implicitly closed during the second iteration.
These examples probably won't convince you, because the scoping is too obvious. But scoping isn't always so obvious, especially when programming in the "global state and gotos" style often required by event-driven architectures.
Similarly, this is normally perfectly fine:
... my $client = $svr->accept; async { ## do things with $client }->detach;
But, this usually not:
... my $client = $svr->accept; async { sleep 10; ## attempts to use $client fail }->detach;
The reason is that before the thread gets around to using its copy of the client handle, the parent thread has accepted another client. Now imagine the sleep isn't a programmed delay, but rather one caused by system loading (cpu; memory; IO) preventing the new thread getting up and running in a timely manner, so that the parent thread implicitly overwrite (and therefore closes) $client before the child thread gets to the point where it increments the reference count.
But you'll dismiss that as a "threads-issue".
I can't offer you an explanation of the linux example I cited -- I don't know the guy, nor do I do Linux -- but if the p5p guys took his perlbug seriously enough to patch perl; that's good enough for me to believe that it was a real issue.
I can also find other references to linux sockets mysteriously going awol, even outside of Perl. What I cannot do is pass judgement on the validity of the claims.
But even if every single occasion when an attempt is made to remove a closed file handle from an IO::Select object is down to programmer error; silently doing nothing and thus screwing the entire select loop is ... is ... shall we stick with: not very friendly.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: Does IO::Select work? (Problem partially resolved)
by andal (Hermit) on Oct 23, 2012 at 14:36 UTC | |
by tye (Sage) on Oct 23, 2012 at 17:35 UTC | |
by andal (Hermit) on Oct 24, 2012 at 08:13 UTC | |
by tye (Sage) on Oct 24, 2012 at 13:14 UTC | |
by andal (Hermit) on Oct 25, 2012 at 06:50 UTC | |
| |
by BrowserUk (Patriarch) on Oct 23, 2012 at 20:45 UTC | |
by Anonymous Monk on Oct 24, 2012 at 11:08 UTC | |
by BrowserUk (Patriarch) on Oct 24, 2012 at 11:33 UTC | |
by zentara (Archbishop) on Oct 23, 2012 at 14:41 UTC |