Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: SIGPIPE not trapped after sleep in CGI

by zwon (Abbot)
on Oct 28, 2012 at 13:37 UTC ( #1001267=note: print w/replies, xml ) Need Help??

in reply to SIGPIPE not trapped after sleep in CGI

Try to add following two lines after print "output #2\n";:

sleep 5; print "output #3\n";
and you will get your SIGPIPE.


So after you printed "output #1" you hit abort in browser, browser sent "FIN" to server, that means that it will not send any data to server, server considers connection open write only after that. Then you print "output #2", server sends it to browser as it thinks connection is still open for writing, no error here and no SIGPIPE. Client receives this "output #2" and replies with "RST" as it considers connection completely closed. After server got "RST" it realise that connection is closed, now if you try to write anything into socket, you will get SIGPIPE.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001267]
[Corion]: The upside to this is that I've reduced my $work (well, $paid) time to 80%, so I'll be at $work only four days/week, which will hopefully make the crunch less crunchy on me ;)
[marto]: yeah, so that stays as before. But before the boys were born I'd be on quite often at night (GMT) also
[marto]: I had the option during our TUPE transfer to buy 5 more days holiday. They were shocked when I did :P

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2017-06-29 08:27 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (655 votes). Check out past polls.