Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: io::select bogs cpu on disconnect

by gbarr (Monk)
on Oct 03, 2001 at 23:45 UTC ( [id://116550]=note: print w/replies, xml ) Need Help??


in reply to io::select bogs cpu on disconnect

When a client closes its connection or gets disconnected select() will report it as being readable. However when you actually read from it sysread will return zero. You should check the result of sysread for this condition and close the connection, but you do not. Because you do not, the select() will continue to report the handle as readable and so you have a loop that never sleeps

Replies are listed 'Best First'.
Re: Re: io::select bogs cpu on disconnect
by Visionary (Initiate) on Oct 03, 2001 at 23:55 UTC
    Gbarr,

    Thank you I owe you my sanity. I was only trapping the writes; not the reads. One simple line at your suggestion:
    if (!$nread) { $sel->remove($client); }
    did the trick.

    Again, thanks!

    Alex

    PS - This is my first visit here, and it is like the holy grail I've been searching for.... You guys are great.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://116550]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-23 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found