]> git.tuebingen.mpg.de Git - paraslash.git/commit
server: Wait for command handler exit also when afs dies.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 21 Sep 2021 12:09:39 +0000 (14:09 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 29 Sep 2021 17:03:37 +0000 (19:03 +0200)
commita16741dcf32b9ed20ca572d6353c3f1b9212a464
tree15828f977956f8dfd9309a3f71bca6e1fec09ac7
parentd9dd85a61ac70314c4842d7ad28bf5eb65c8c712
server: Wait for command handler exit also when afs dies.

When para_server is running in foreground mode in a terminal session,
and gets signalled by hitting CTRL+C, it is unspecified whether the
server or the afs process receive the resulting SIGINT first. It may
even happen that the afs process dies first, and that the server sees
the resulting SIGCHLD *before* the SIGINT.

In this case we currently don't wait for the command handlers to exit
but proceed right away with the shutdown, closing the signal pipe and
destroying the shared memory area which contains the mmd structure.
This leads to error messages on shutdown such as

Sep 21 12:38:18 (5) (29166) para_semop: semaphore set 12648470 was removed
Sep 21 12:38:18 (6) (29166) para_semop: fatal semop error Invalid argument: pid 29166
Sep 21 12:38:18 (6) (29161) generic_signal_handler: Bad file descriptor
Sep 21 12:38:18 (6) (29164) para_semop: fatal semop error Invalid argument: pid 29164
Sep 21 12:38:18 (6) (29165) command_handler_sighandler: terminating on signal 15
Sep 21 12:38:18 (6) (29165) para_semop: fatal semop error Invalid argument: pid 29165

This commit avoids the issue by letting the server wait for all
its children also in the SIGCHILD case when we exit because the afs
process has terminated.
server.c