Changeset: 8ed49c02f14a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8ed49c02f14a
Modified Files:
        tools/merovingian/daemon/forkmserver.c
Branch: Jun2016
Log Message:

Block SIGCHLD signal when doing administration around fork().
Also see bug 4066.


diffs (43 lines):

diff --git a/tools/merovingian/daemon/forkmserver.c 
b/tools/merovingian/daemon/forkmserver.c
--- a/tools/merovingian/daemon/forkmserver.c
+++ b/tools/merovingian/daemon/forkmserver.c
@@ -54,6 +54,7 @@ forkMserver(char *database, sabdb** stat
        char upmax[8];
        confkeyval *ckv, *kv, *list;
        SABdbState state;
+       sigset_t blocksig;
 
        er = msab_getStatus(stats, database);
        if (er != NULL) {
@@ -257,6 +258,9 @@ forkMserver(char *database, sabdb** stat
                                        database, database));
        }
 
+       sigemptyset(&blocksig);
+       sigaddset(&blocksig, SIGCHLD);
+       pthread_sigmask(SIG_BLOCK, &blocksig, (sigset_t *) 0);
        pid = fork();
        if (pid == 0) {
                char *sabdbfarm;
@@ -275,6 +279,10 @@ forkMserver(char *database, sabdb** stat
                int c = 0;
                unsigned int mport;
 
+               sigemptyset(&blocksig);
+               sigaddset(&blocksig, SIGCHLD);
+               pthread_sigmask(SIG_UNBLOCK, &blocksig, (sigset_t *) 0);
+
                er = msab_getDBfarm(&sabdbfarm);
                if (er != NULL) {
                        Mfprintf(stderr, "unexpected error: %s\n", er);
@@ -446,6 +454,10 @@ forkMserver(char *database, sabdb** stat
 
                        pthread_mutex_unlock(&_mero_topdp_lock);
 
+                       sigemptyset(&blocksig);
+                       sigaddset(&blocksig, SIGCHLD);
+                       pthread_sigmask(SIG_UNBLOCK, &blocksig, (sigset_t *) 0);
+
                        /* wait for the child to finish starting, at some point 
we
                         * decided that we should wait indefinitely here 
because if the
                         * mserver needs time to start up, we shouldn't 
interrupt it,
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to