[OpenSRF-GIT] OpenSRF branch master updated. ea72acaf798f3fc6cc0aae8d93771c6dc2a21a57
Evergreen Git
git at git.evergreen-ils.org
Fri Sep 8 16:56:46 EDT 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OpenSRF".
The branch, master has been updated
via ea72acaf798f3fc6cc0aae8d93771c6dc2a21a57 (commit)
from 53e7f82b534eef2b513fe31bcb2a9c719a7ee746 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ea72acaf798f3fc6cc0aae8d93771c6dc2a21a57
Author: Bill Erickson <berickxx at gmail.com>
Date: Fri Jun 9 13:01:46 2017 -0400
LP#1697029 Log and exit on write to dead child
Confirm that a child process is alive just before attempting to write to
its pipe. If the child process is dead, log the error, then drop the
message and move on. This allows the parent to continue servicing
future requests.
Signed-off-by: Bill Erickson <berickxx at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/src/perl/lib/OpenSRF/Server.pm b/src/perl/lib/OpenSRF/Server.pm
index dcf44fe..ba463e4 100644
--- a/src/perl/lib/OpenSRF/Server.pm
+++ b/src/perl/lib/OpenSRF/Server.pm
@@ -303,6 +303,19 @@ sub write_child {
$self->{sig_pipe} = 0;
local $SIG{'PIPE'} = sub { $self->{sig_pipe} = 1; };
+ # In rare cases a child can die between creation and first
+ # write, typically a result of a jabber connect error. Before
+ # sending data to each child, confirm it's still alive. If it's
+ # not, log the error and drop the message to prevent the parent
+ # process from dying.
+ # When a child dies, all of its attributes are deleted,
+ # so the lack of a pid means the child is dead.
+ if (!$child->{pid}) {
+ $logger->error("server: child is dead in write_child(). ".
+ "unable to send message: $xml");
+ return; # avoid syswrite crash
+ }
+
# send message to child data pipe
syswrite($child->{pipe_to_child}, $write_size . $xml);
-----------------------------------------------------------------------
Summary of changes:
src/perl/lib/OpenSRF/Server.pm | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
hooks/post-receive
--
OpenSRF
More information about the opensrf-commits
mailing list