in reply to Re^2: Is this a bug of perl threads?
in thread SOLVED: Is this a bug of perl threads?

That particular signal occurs when you attempt to write to a pipe or socket that's been disconnected. The default action is to kill the process. You can safely ignore the signal. In exchange, you should check if print succeeds, and exit the loop if not.
sub server { local $SIG{PIPE} = 'IGNORE'; while (my $client = $server->accept()) { for my $sec (1..60) { sleep 1; print $client "$sec\n" or last; } } }