b888 has asked for the wisdom of the Perl Monks concerning the following question:
Greetings.
I have written server application on perl and everything looked fine utill Linux to FreeBSD migration. Now the same code seems to work in different way sometimes.
while( 1 ){ my $paddr = accept( Client, Server ); next if not $paddr; my $buf = ''; eval { local $SIG{'ALRM'} = sub { die "time\n" }; Time::HiRes::alarm( $READ_TIMEOUT ); recv Client, $buf, $MAX_REQ_LEN, 0; Time::HiRes::alarm( 0 ); }; if( $@ ){ # operation timeout / met errors d 'Timeout on read'; close Client; next; } ...
I've redirected stdout and stderr in file and sometimes the string "time" appear in it + server goes away. Wonder why that happens and how to avoid that? Thanks :)
p.s.
v5.8.7 built for i386-freebsd-64int
FreeBSD 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Wed Feb 8 13:33:28 UTC 2006
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: $SIG{'ALRM'} on FreeBSD
by sh1tn (Priest) on Feb 24, 2006 at 11:46 UTC | |
by b888 (Beadle) on Feb 24, 2006 at 12:03 UTC | |
by jonadab (Parson) on Feb 24, 2006 at 14:28 UTC | |
by b888 (Beadle) on Feb 24, 2006 at 15:25 UTC | |
|
Re: $SIG{'ALRM'} on FreeBSD
by jonadab (Parson) on Feb 24, 2006 at 13:19 UTC | |
by b888 (Beadle) on Feb 24, 2006 at 13:38 UTC | |
by jonadab (Parson) on Feb 24, 2006 at 15:48 UTC | |
|
Re: $SIG{'ALRM'} on FreeBSD
by acid06 (Friar) on Feb 24, 2006 at 14:02 UTC | |
|
Re: $SIG{'ALRM'} on FreeBSD
by samizdat (Vicar) on Feb 24, 2006 at 20:03 UTC |