Skip to content

[BUG] Unhandled RuntimeException in PreProcessor or PostProcessor aborts remaining processors, assertions, and cleanup #6734

Description

@rajat315315

Expected behavior

Description

Currently in JMeterThread.java, execution loops for PreProcessors (runPreProcessors) and PostProcessors (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 PreProcessors or PostProcessors.
  • 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:

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_

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions