laforge has submitted this change. ( 
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, 9 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved




diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c
index fc8f480..5d46f97 100644
--- a/src/bankd/bankd_main.c
+++ b/src/bankd/bankd_main.c
@@ -55,6 +55,7 @@
 #define SIGMAPADD      SIGRTMIN+2

 static void handle_sig_usr1(int sig);
+static void handle_sig_pipe(int sig);
 static void handle_sig_mapdel(int sig);
 static void handle_sig_mapadd(int sig);

@@ -439,6 +440,7 @@
        g_bankd->main = pthread_self();
        signal(SIGMAPDEL, handle_sig_mapdel);
        signal(SIGMAPADD, handle_sig_mapadd);
+       signal(SIGPIPE, handle_sig_pipe);
        signal(SIGUSR1, handle_sig_usr1);

        LOGP(DMAIN, LOGL_INFO, "Reading PCSC slots...\n");
@@ -557,6 +559,13 @@
        /* do nothing */
 }

+/* signal handler for receiving SIGPIPE from worker thread */
+static void handle_sig_pipe(int sig)
+{
+       /* DO NOT LOG ANYTHING HERE, IT WILL DEADLOCK WITH THE 
osmo_log_tgt_mutex */
+       /* do nothing */
+}
+
 static void handle_sig_usr1(int sig)
 {
        OSMO_ASSERT(sig == SIGUSR1);

--
To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/42665?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-Change-Id: I13d6e9da48d12f93c00bd2d021789bde71aca7cf
Gerrit-Change-Number: 42665
Gerrit-PatchSet: 6
Gerrit-Owner: jolly <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: lynxis lazus <[email protected]>

Reply via email to