rajat315315 opened a new issue, #6734:
URL: https://github.com/apache/jmeter/issues/6734

   ### Expected behavior
   
   ## Description
   Currently in `JMeterThread.java`, execution loops for `PreProcessor`s 
(`runPreProcessors`) and `PostProcessor`s (`runPostProcessors`) do not wrap 
individual element processing in `try-catch` blocks.
   
   If any `PreProcessor` or `PostProcessor` throws an unhandled 
`RuntimeException` (e.g. `NullPointerException`, `IndexOutOfBoundsException`, 
or malformed extraction error):
   1. **Processor Execution Aborts**: The `for` loop in `runPreProcessors` / 
`runPostProcessors` immediately terminates, skipping all subsequent processors 
attached to the same sampler.
   2. **Sampling Pipeline Bypass**: Uncaught exceptions in post-processors 
bypass downstream steps in `executeSamplePackage` including 
`checkAssertions()`, listener notifications (`notifyListeners`), and compiler 
resource cleanup (`compiler.done(pack)`).
   
   By contrast, assertion processing in `JMeterThread.processAssertion()` 
explicitly wraps each assertion in `try-catch (Exception | JMeterError e)` to 
log errors and allow remaining pipeline elements to execute.
   
   ## Expected Behavior
   When a `PreProcessor` or `PostProcessor` throws a runtime exception:
   - The error should be logged with the element's name and stack trace.
   - The thread should continue executing remaining `PreProcessor`s or 
`PostProcessor`s.
   - Sample assertions, listener notifications, and compiler cleanup should 
execute normally.
   
   ### Actual behavior
   
   An exception in a single processor breaks out of the loop, skipping all 
remaining processors, assertions, and test element cleanup.
   
   ### Steps to reproduce the problem
   
   
   In `src/core/src/main/java/org/apache/jmeter/threads/JMeterThread.java`:
   ```java
   private static void runPostProcessors(List<? extends PostProcessor> 
extractors) {
       for (PostProcessor ex : extractors) {
           TestBeanHelper.prepare((TestElement) ex);
           ex.process(); // Uncaught RuntimeException breaks loop and caller 
pipeline
       }
   }
   
   ### JMeter Version
   
   6.0.0-SNAPSHOT
   
   ### Java Version
   
   JDK 17 / JDK 21
   
   ### OS Version
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to