Browse Source

Merge branch 'candidate-7.6.x'

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 5 years ago
parent
commit
2b09444fdf

+ 10 - 1
system/jlib/jexcept.cpp

@@ -1101,6 +1101,12 @@ static void throwSigSegV()
 }
 #endif
 
+static std::atomic<bool> processAborted { false };
+void jlib_decl setProcessAborted(bool _abortVal)
+{
+    processAborted = _abortVal;
+}
+
 NO_SANITIZE("alignment") void excsighandler(int signum, siginfo_t *info, void *extra)
 {
     static byte nested=0;
@@ -1354,7 +1360,10 @@ NO_SANITIZE("alignment") void excsighandler(int signum, siginfo_t *info, void *e
         if ( SEHHandler->fireException(new CSEHException(signum,s.str())) )
             return;
     }
-    raise(signum);
+    if ( (SIGABRT == signum) && (processAborted) )
+        _exit(128 + SIGABRT);
+    else
+        raise(signum);
 #endif
     nested--;
 }

+ 1 - 0
system/jlib/jexcept.hpp

@@ -129,6 +129,7 @@ void jlib_decl *setSEHtoExceptionHandler(IExceptionHandler *handler); // sets ha
 void jlib_decl setTerminateOnSEHInSystemDLLs(bool set=true);
 void jlib_decl setTerminateOnSEH(bool set=true);
 
+void jlib_decl setProcessAborted(bool _abortVal);
 
 __declspec(noreturn) void jlib_decl throwUnexpectedException(const char * file, unsigned line) __attribute__((noreturn));
 __declspec(noreturn) void jlib_decl throwUnexpectedException(const char * where, const char * file, unsigned line) __attribute__((noreturn));

+ 7 - 0
thorlcr/graph/thgraph.cpp

@@ -1732,6 +1732,13 @@ void CGraphBase::abort(IException *e)
 
         abortException.set(e);
         aborted = true;
+
+        if (!job.getOptBool("coreOnAbort", false))
+        {
+            // prevent dtors throwing ... __verbose_terminate_handler()->abort()->raise()->core files
+            setProcessAborted(true);
+        }
+
         graphCancelHandler.cancel(0);
 
         if (0 == containers.count())

+ 3 - 0
thorlcr/master/thgraphmanager.cpp

@@ -694,6 +694,9 @@ void CJobManager::run()
         { 
             reply(workunit, wuid, MakeStringException(0, "Unknown exception"), agentep, false); 
         }
+
+        // reset for next job
+        setProcessAborted(false);
     }
     delete dp;
     jobq.clear();

+ 15 - 6
thorlcr/msort/tsorts.cpp

@@ -796,12 +796,21 @@ public:
     }
     ~CThorSorter()
     {
-        stop();
-        ActPrintLog(activity, "Joining Sort Slave Server");
-        verifyex(threaded.join(10*60*1000));
-        myendpoint.set(NULL,0);
-        rowArray.kill();
-        ActPrintLog(activity, "~CThorSorter");
+        try
+        {
+            stop();
+            ActPrintLog(activity, "Joining Sort Slave Server");
+            verifyex(threaded.join(10*60*1000));
+            myendpoint.set(NULL,0);
+            rowArray.kill();
+            ActPrintLog(activity, "~CThorSorter");
+        }
+        catch (IException *e)
+        {
+            e->Release();
+        }
+        // do we ignore other exceptions (...) here ?
+        // if so, we may have std::terminate call abort() ...
     }
 // ISortSlaveMP
     virtual bool Connect(unsigned _partno, unsigned _numnodes)

+ 17 - 4
thorlcr/slave/slavmain.cpp

@@ -1641,10 +1641,19 @@ public:
     }
     ~CJobListener()
     {
-        for (unsigned sc=1; sc<channelsPerSlave; sc++)
-            mpServers.item(sc).stop();
-        mpServers.kill();
-        stop();
+        try
+        {
+            for (unsigned sc=1; sc<channelsPerSlave; sc++)
+                mpServers.item(sc).stop();
+            mpServers.kill();
+            stop();
+        }
+        catch (IException *e)
+        {
+            e->Release();
+        }
+        // do we ignore other exceptions (...) here ?
+        // if so, we may have std::terminate call abort() ...
     }
     void stop()
     {
@@ -1863,6 +1872,10 @@ public:
                         }
                         jobs.removeExact(job);
                         PROGLOG("QueryDone, removed %s from jobs", key.get());
+
+                        // reset for next job
+                        setProcessAborted(false);
+
                         if (exception)
                             throw exception.getClear(); // NB: this will cause exception to be part of the reply to master