2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

daemon: Better log when fork child dies early from signals.

On one machine, "/etc/init.d/openvswitch-switch start" failed to start
with:

   ovs-vswitchd: fork child failed to signal startup (Success)
   Starting ovs-vswitchd ... failed!

"strace" revealed that the fork child was actually segfaulting, but the
message output didn't indicate that in any way.  This commit fixes the
log message (but not the segfault itself).

Reported-by: Michael Hu <mhu@nicira.com>
Bug #8457.
This commit is contained in:
Ben Pfaff
2011-11-23 12:15:42 -08:00
parent 2c5a683451
commit 2c8fcc9cd6
2 changed files with 26 additions and 15 deletions

View File

@@ -245,13 +245,19 @@ def _fork_and_wait_for_startup():
break
if len(s) != 1:
retval, status = _waitpid(pid, 0)
if (retval == pid and
os.WIFEXITED(status) and os.WEXITSTATUS(status)):
# Child exited with an error. Convey the same error to
# our parent process as a courtesy.
sys.exit(os.WEXITSTATUS(status))
if retval == pid:
if os.WIFEXITED(status) and os.WEXITSTATUS(status):
# Child exited with an error. Convey the same error to
# our parent process as a courtesy.
sys.exit(os.WEXITSTATUS(status))
else:
sys.stderr.write("fork child failed to signal "
"startup (%s)\n"
% ovs.process.status_msg(status))
else:
sys.stderr.write("fork child failed to signal startup\n")
assert retval < 0
sys.stderr.write("waitpid failed (%s)\n"
% os.strerror(-retval))
sys.exit(1)
os.close(rfd)