jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/42665?usp=email )
Change subject: Fix: Prevent bankd from exiting upon SIGPIPE ......................................................................
Fix: Prevent bankd from exiting upon SIGPIPE
IF a client disconnects from a worker thread while the worker is responding to a to a request from that client, the socket is closed and SIGPIPE is sent to the worker, causing the application to exit.
To prevent this, all workers have a dummy handler to prevent this. Now the worker can handle the closing of the socket.
Change-Id: I13d6e9da48d12f93c00bd2d021789bde71aca7cf --- M src/bankd/bankd_main.c 1 file changed, 8 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/65/42665/1
diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c index c6b0f1c..204ee24 100644 --- a/src/bankd/bankd_main.c +++ b/src/bankd/bankd_main.c @@ -562,6 +562,12 @@ /* do nothing */ }
+/* signal handler for receiving SIGPIPE from worker thread */ +static void handle_sig_pipe(int sig) +{ + /* do nothing */ +} + static void handle_sig_usr1(int sig) { OSMO_ASSERT(sig == SIGUSR1); @@ -1068,6 +1074,8 @@ g_worker->slot.bank_id = 0xffff; g_worker->slot.slot_nr = 0xffff;
+ signal(SIGPIPE, handle_sig_pipe); + /* we continuously perform the same loop here, recycling the worker thread * once the client connection is gone or we have some trouble with the card/reader */ while (1) {