--- AnyEvent-Fork-RPC/RPC.pm 2013/04/18 20:04:51 1.17 +++ AnyEvent-Fork-RPC/RPC.pm 2013/04/21 12:01:54 1.21 @@ -552,7 +552,8 @@ if (@rcb || %rcb) { $on_error->("unexpected eof"); } else { - $on_destroy->(); + $on_destroy->() + if $on_destroy; } } elsif ($! != Errno::EAGAIN && $! != Errno::EWOULDBLOCK) { undef $rw; undef $ww; # it ends here @@ -565,7 +566,8 @@ my $guard = Guard::guard { $shutdown = 1; - $ww ||= $fh && AE::io $fh, 1, $wcb; + + shutdown $fh, 1 if $fh && !$ww; }; my $id; @@ -577,7 +579,7 @@ $rcb{$id} = pop; - $guard; # keep it alive + $guard if 0; # keep it alive $wbuf .= pack "LL/a*", $id, &$f; $ww ||= $fh && AE::io $fh, 1, $wcb; @@ -773,6 +775,13 @@ so you might want to look into L which can handle the gory details. +=head1 EXCEPTIONS + +There are no provisions whatsoever for catching exceptions at this time - +in the child, exeptions might kill the process, causing calls to be lost +and the parent encountering a fatal error. In the parent, exceptions in +the result callback will not be caught and cause undefined behaviour. + =head1 SEE ALSO L, to create the processes in the first place.