Skip to content

Suppression of JUnit's default @Timeout handling not working when running from IDE #1060

Description

@Marcono1234

Version

  • jazzer-junit: 0.30.0
  • IntelliJ IDEA 2026.1.4

Description

Follow-up for #930

Jazzer uses JUnit's @Timeout annotation to set its own fuzzing timeout, and is then supposed to suppress JUnit's own timeout handling:

// JUnit's timeout handling interferes with libFuzzer as from the point of view of JUnit
// all fuzz test invocations are combined in a single JUnit test method execution.
// https://junit.org/junit5/docs/current/user-guide/#writing-tests-declarative-timeouts-mode
.configurationParameter("junit.jupiter.execution.timeout.mode", timeoutMode)

However, when running JUnit tests directly from the IDE (IntelliJ IDEA), it seems this code is not executed and JUnit's timeout handling is not suppressed. So even though fuzzing succeeds, JUnit might erroneously report a timeout failure at the end if the total time of all executions 'exceeded' the timeout.

Reproduction steps

Create a dummy fuzzing test:

import com.code_intelligence.jazzer.junit.FuzzTest;
import org.junit.jupiter.api.Timeout;

import java.util.concurrent.TimeUnit;

public class TimeoutTest {
    @Timeout(value = 3, unit = TimeUnit.SECONDS)
    @FuzzTest(maxDuration = "5s")
    void test(byte[] bytes) {
    }
}

Then run the test from within the IDE, and edit the run configuration to set the environment variable JAZZER_FUZZ=1.

❌ Bug: Fuzzing succeeds, but the execution fails at the end: "TimeoutException: test([B) timed out after 3 seconds"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions