diff --git a/GaudiHive/src/HiveSlimEventLoopMgr.cpp b/GaudiHive/src/HiveSlimEventLoopMgr.cpp
index 0657f36b8413662f2ade2c89000be5e7ae18fa98..2e14a5977e534e304db1793b162e846fa46fda25 100644
--- a/GaudiHive/src/HiveSlimEventLoopMgr.cpp
+++ b/GaudiHive/src/HiveSlimEventLoopMgr.cpp
@@ -10,6 +10,7 @@
 \***********************************************************************************/
 // Local includes
 #include "HiveSlimEventLoopMgr.h"
+#include "GaudiKernel/StatusCode.h"
 #include "HistogramAgent.h"
 
 // Framework includes
@@ -376,8 +377,9 @@ StatusCode HiveSlimEventLoopMgr::nextEvent( int maxevt ) {
 
   constexpr double oneOver1024 = 1. / 1024.;
 
-  uint iteration  = 0;
-  auto start_time = Clock::now();
+  uint       iteration  = 0;
+  auto       start_time = Clock::now();
+  StatusCode finalSC;
   while ( !loop_ended && ( maxevt < 0 || ( finishedEvts + skippedEvts ) < maxevt ) ) {
     DEBUG_MSG << "work loop iteration " << iteration++ << endmsg;
     // if the created events did not reach maxevt, create an event
@@ -428,7 +430,10 @@ StatusCode HiveSlimEventLoopMgr::nextEvent( int maxevt ) {
       DEBUG_MSG << "Draining the scheduler" << endmsg;
 
       // Pull out of the scheduler the finished events
-      if ( drainScheduler( finishedEvts ).isFailure() ) loop_ended = true;
+      if ( drainScheduler( finishedEvts ).isFailure() ) {
+        loop_ended = true;
+        finalSC    = StatusCode::FAILURE;
+      }
       newEvtAllowed = true;
     }
   } // end main loop on finished events
@@ -439,7 +444,7 @@ StatusCode HiveSlimEventLoopMgr::nextEvent( int maxevt ) {
          << std::chrono::duration_cast<std::chrono::nanoseconds>( end_time - start_time ).count() << endmsg;
   info() << skippedEvts << " events were SKIPed" << endmsg;
 
-  return StatusCode::SUCCESS;
+  return finalSC;
 }
 
 //---------------------------------------------------------------------------
diff --git a/GaudiHive/tests/qmtest/gaudihive.qms/avalanche_scheduler.qms/conditions_stall.qmt b/GaudiHive/tests/qmtest/gaudihive.qms/avalanche_scheduler.qms/conditions_stall.qmt
index 1301369ace4716094f75662d71c843ca0377d0bf..082990de70079ad8340bdc2c77915856d0483da1 100644
--- a/GaudiHive/tests/qmtest/gaudihive.qms/avalanche_scheduler.qms/conditions_stall.qmt
+++ b/GaudiHive/tests/qmtest/gaudihive.qms/avalanche_scheduler.qms/conditions_stall.qmt
@@ -19,4 +19,5 @@ if stdout.find(expected_string) == -1:
     result[&apos;GaudiTest.expected_string&apos;] = result.Quote(expected_string)
 </text></argument>
 <argument name="timeout"><integer>60</integer></argument>
++<argument name="exit_code"><integer>1</integer></argument>
 </extension>
diff --git a/GaudiHive/tests/qmtest/gaudihive.qms/avalanche_scheduler.qms/detect_stall.qmt b/GaudiHive/tests/qmtest/gaudihive.qms/avalanche_scheduler.qms/detect_stall.qmt
index 236142363892c0f9c3c4b892b56fbe64ad558337..9326fd234f6af62ab14d716b0bd4306177437174 100644
--- a/GaudiHive/tests/qmtest/gaudihive.qms/avalanche_scheduler.qms/detect_stall.qmt
+++ b/GaudiHive/tests/qmtest/gaudihive.qms/avalanche_scheduler.qms/detect_stall.qmt
@@ -19,4 +19,5 @@ if stdout.find(expected_string) == -1:
     result[&apos;GaudiTest.expected_string&apos;] = result.Quote(expected_string)
 </text></argument>
 <argument name="timeout"><integer>60</integer></argument>
++<argument name="exit_code"><integer>1</integer></argument>
 </extension>
diff --git a/GaudiHive/tests/qmtest/gaudihive.qms/avalanche_scheduler.qms/view_data_isolation_test.qmt b/GaudiHive/tests/qmtest/gaudihive.qms/avalanche_scheduler.qms/view_data_isolation_test.qmt
index 64470b5527e42736a010e0bdb75a84ee8182dcd2..dec7a4c58c095657efaa9868255f917d93de776f 100644
--- a/GaudiHive/tests/qmtest/gaudihive.qms/avalanche_scheduler.qms/view_data_isolation_test.qmt
+++ b/GaudiHive/tests/qmtest/gaudihive.qms/avalanche_scheduler.qms/view_data_isolation_test.qmt
@@ -18,6 +18,7 @@
 <argument name="use_temp_dir"><enumeral>true</enumeral></argument>
 <argument name="timeout"><integer>120</integer></argument>
 <argument name="reference"><text>refs/SubSlotVsSlotIsolation.ref</text></argument>
+<argument name="exit_code"><integer>1</integer></argument>
 <argument name="environment"><set>
 <text>GAUDIAPPNAME=</text>
 <text>GAUDIAPPVERSION=</text>
diff --git a/GaudiHive/tests/qmtest/refs/SubSlotVsSlotIsolation.ref b/GaudiHive/tests/qmtest/refs/SubSlotVsSlotIsolation.ref
index 924078688d632b4cfd3315c66ac8f5847498c9f8..92e31ff76d0a584bf9f9b2512b7e0eaa14e5eb56 100644
--- a/GaudiHive/tests/qmtest/refs/SubSlotVsSlotIsolation.ref
+++ b/GaudiHive/tests/qmtest/refs/SubSlotVsSlotIsolation.ref
@@ -244,4 +244,4 @@ ApplicationMgr       INFO Application Manager Stopped successfully
 HiveSlimEventLo...   INFO Histograms converted successfully according to request.
 AvalancheSchedu...   INFO Joining Scheduler thread
 ApplicationMgr       INFO Application Manager Finalized successfully
-ApplicationMgr       INFO Application Manager Terminated successfully
+ApplicationMgr      ERROR Application Manager Terminated with error code 1
diff --git a/GaudiTestSuite/options/SlimExitWithFailure.py b/GaudiTestSuite/options/SlimExitWithFailure.py
new file mode 100644
index 0000000000000000000000000000000000000000..52a668436dc1e3da2e6baac7aa0590b3b98dd90b
--- /dev/null
+++ b/GaudiTestSuite/options/SlimExitWithFailure.py
@@ -0,0 +1,36 @@
+#####################################################################################
+# (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations #
+#                                                                                   #
+# This software is distributed under the terms of the Apache version 2 licence,     #
+# copied verbatim in the file "LICENSE".                                            #
+#                                                                                   #
+# In applying this licence, CERN does not waive the privileges and immunities       #
+# granted to it by virtue of its status as an Intergovernmental Organization        #
+# or submit itself to any jurisdiction.                                             #
+#####################################################################################
+###############################################################
+# Job options file
+# ==============================================================
+from Configurables import ApplicationMgr, AvalancheSchedulerSvc
+from Configurables import Gaudi__TestSuite__IntDataConsumer as IntDataConsumer
+from Configurables import GaudiExamplesCommonConf, HiveSlimEventLoopMgr, HiveWhiteBoard
+from Gaudi.Configuration import ERROR, WARNING
+
+threads = 1
+
+GaudiExamplesCommonConf()
+
+slimeventloopmgr = HiveSlimEventLoopMgr(
+    SchedulerName="AvalancheSchedulerSvc", OutputLevel=ERROR
+)
+whiteboard = HiveWhiteBoard("EventDataSvc")
+
+scheduler = AvalancheSchedulerSvc(ThreadPoolSize=threads, OutputLevel=WARNING)
+
+ApplicationMgr(
+    TopAlg=[IntDataConsumer()],
+    EvtMax=10,
+    EvtSel="NONE",
+    EventLoop=slimeventloopmgr,
+    ExtSvc=[whiteboard],
+)
diff --git a/GaudiTestSuite/options/ToolHandles.py b/GaudiTestSuite/options/ToolHandles.py
index e978f6a51d3dca55acbca32f0363781d0dc34054..ecb4366fd165706a0f29c2908a4409dcf750b51d 100644
--- a/GaudiTestSuite/options/ToolHandles.py
+++ b/GaudiTestSuite/options/ToolHandles.py
@@ -1,5 +1,5 @@
 #####################################################################################
-# (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations #
+# (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations #
 #                                                                                   #
 # This software is distributed under the terms of the Apache version 2 licence,     #
 # copied verbatim in the file "LICENSE".                                            #
@@ -31,5 +31,9 @@ topalgs[-1].FloatTool.OutputLevel = INFO
 
 # Application manager
 app = ApplicationMgr(
-    EvtMax=4, ExtSvc=[whiteboard], EventLoop=slimeventloopmgr, TopAlg=topalgs
+    EvtMax=4,
+    ExtSvc=[whiteboard],
+    EventLoop=slimeventloopmgr,
+    TopAlg=topalgs,
+    EvtSel="NONE",
 )
diff --git a/GaudiTestSuite/tests/qmtest/gauditestsuite.qms/control_flow.qms/toolhandles.qmt b/GaudiTestSuite/tests/qmtest/gauditestsuite.qms/control_flow.qms/toolhandles.qmt
index 7d6325382648f8f85dd3161c785c18744cb6b743..b746c7c433d2576ab3fbfd37474ea73d15e8f2b4 100644
--- a/GaudiTestSuite/tests/qmtest/gauditestsuite.qms/control_flow.qms/toolhandles.qmt
+++ b/GaudiTestSuite/tests/qmtest/gauditestsuite.qms/control_flow.qms/toolhandles.qmt
@@ -1,6 +1,6 @@
 <?xml version="1.0" ?><!DOCTYPE extension  PUBLIC '-//QM/2.3/Extension//EN'  'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
 <!--
-    (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations
+    (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations
 
     This software is distributed under the terms of the Apache version 2 licence,
     copied verbatim in the file "LICENSE".
@@ -13,4 +13,10 @@
 <argument name="program"><text>gaudirun.py</text></argument>
 <argument name="args"><set><text>../../options/ToolHandles.py</text></set></argument>
 <argument name="reference"><text>refs/ToolHandles.ref</text></argument>
+<argument name="exit_code"><integer>0</integer></argument>
+<argument name="validator"><text>
+# ignore order of lines printed during execution
+preprocessor = normalizeTestSuite + SortGroupOfLines(r"^THData.*INFO executing")
+validateWithReference(preproc = preprocessor)
+</text></argument>
 </extension>
diff --git a/GaudiTestSuite/tests/qmtest/gauditestsuite.qms/multithreading.qms/slimeventloop_exit_when_failure.qmt b/GaudiTestSuite/tests/qmtest/gauditestsuite.qms/multithreading.qms/slimeventloop_exit_when_failure.qmt
new file mode 100644
index 0000000000000000000000000000000000000000..9cd6f933749a479be21053b472d712d58e8a7a03
--- /dev/null
+++ b/GaudiTestSuite/tests/qmtest/gauditestsuite.qms/multithreading.qms/slimeventloop_exit_when_failure.qmt
@@ -0,0 +1,20 @@
+<?xml version="1.0" ?><!DOCTYPE extension  PUBLIC '-//QM/2.3/Extension//EN'  'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
+<!--
+    (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations
+
+    This software is distributed under the terms of the Apache version 2 licence,
+    copied verbatim in the file "LICENSE".
+
+    In applying this licence, CERN does not waive the privileges and immunities
+    granted to it by virtue of its status as an Intergovernmental Organization
+    or submit itself to any jurisdiction.
+-->
+<extension class="GaudiTest.GaudiExeTest" kind="test">
+<argument name="program"><text>gaudirun.py</text></argument>
+<argument name="args"><set>
+  <text>../../options/SlimExitWithFailure.py</text>
+</set></argument>
+<argument name="timeout"><integer>30</integer></argument>
+<argument name="use_temp_dir"><enumeral>true</enumeral></argument>
+<argument name="exit_code"><integer>1</integer></argument>
+</extension>
diff --git a/GaudiTestSuite/tests/qmtest/refs/ToolHandles.ref b/GaudiTestSuite/tests/qmtest/refs/ToolHandles.ref
index 42e8248a30ae318de0b348f569560f859192adc2..8b509d97a6346de0096da802399f5e5cc47202ae 100644
--- a/GaudiTestSuite/tests/qmtest/refs/ToolHandles.ref
+++ b/GaudiTestSuite/tests/qmtest/refs/ToolHandles.ref
@@ -1,10 +1,10 @@
 # setting LC_ALL to "C"
-# --> Including file '/build/Gaudi/GaudiTestSuite/options/ToolHandles.py'
-# <-- End of file '/build/Gaudi/GaudiTestSuite/options/ToolHandles.py'
+# --> Including file '/home/marcocle/stacks/master/Gaudi/GaudiTestSuite/options/ToolHandles.py'
+# <-- End of file '/home/marcocle/stacks/master/Gaudi/GaudiTestSuite/options/ToolHandles.py'
 ApplicationMgr    SUCCESS
 ====================================================================================================================================
-                                                   Welcome to main version 36.12
-                                          running on build-host.cern.ch on Wed Mar 29 18:41:34 2023
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v38r2)
+                                          running on lbbuildinter01.cern.ch on Tue May 14 12:32:33 2024
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
 ThreadPoolSvc        INFO no thread init tools attached
@@ -46,15 +46,25 @@ AvalancheSchedu...   INFO Task scheduling settings:
 AvalancheSchedu...   INFO  o Avalanche generation mode: disabled
 AvalancheSchedu...   INFO  o Preemptive scheduling of CPU-blocking tasks: disabled
 AvalancheSchedu...   INFO  o Scheduling of condition tasks: disabled
+HiveSlimEventLo...WARNING Unable to locate service "EventSelector"
+HiveSlimEventLo...WARNING No events will be processed from external input.
 HiveSlimEventLo...   INFO Found 0 events in black list
 ApplicationMgr       INFO Application Manager Initialized successfully
-JobOptionsSvc        INFO Properties are dumped into "gauditestsuite.control_flow.toolhandles.joboptsdump"
 ApplicationMgr       INFO Application Manager Started successfully
 HiveSlimEventLo...   INFO Starting loop on events
-EventSelector        INFO End of event input reached.
-HiveSlimEventLo...   INFO No more events in event selection
-HiveSlimEventLo...  ERROR Detected nullptr ctxt before clearing WB!
-HiveSlimEventLo...   INFO ---> Loop Finished (skipping 1st evt) -  WSS 262.766 total time 39910
+THDataProducer       INFO executing IntDataProducer, storing 7 into /Event/MyInt
+THDataProducer2      INFO executing IntDataProducer, storing 7.0 into /Event/MyFloat
+THDataConsumer       INFO executing IntDataConsumer, checking 7 from /Event/MyInt and 7 from FloatTool are matching
+THDataProducer       INFO executing IntDataProducer, storing 7 into /Event/MyInt
+THDataProducer2      INFO executing IntDataProducer, storing 7.0 into /Event/MyFloat
+THDataProducer2      INFO executing IntDataProducer, storing 7.0 into /Event/MyFloat
+THDataProducer       INFO executing IntDataProducer, storing 7 into /Event/MyInt
+THDataConsumer       INFO executing IntDataConsumer, checking 7 from /Event/MyInt and 7 from FloatTool are matching
+THDataConsumer       INFO executing IntDataConsumer, checking 7 from /Event/MyInt and 7 from FloatTool are matching
+THDataProducer       INFO executing IntDataProducer, storing 7 into /Event/MyInt
+THDataProducer2      INFO executing IntDataProducer, storing 7.0 into /Event/MyFloat
+THDataConsumer       INFO executing IntDataConsumer, checking 7 from /Event/MyInt and 7 from FloatTool are matching
+HiveSlimEventLo...   INFO ---> Loop Finished (skipping 1st evt) -  WSS 306.566 total time 56431
 HiveSlimEventLo...   INFO 0 events were SKIPed
 ApplicationMgr       INFO Application Manager Stopped successfully
 HiveSlimEventLo...   INFO Histograms converted successfully according to request.