oracle/graal · error · GraalError

invalid arguments to BenchmarkDynamicCounters: err|out

Error message

invalid arguments to BenchmarkDynamicCounters: err|out

What it means

GraalError thrown while parsing -Dgraal.BenchmarkDynamicCounters: the arity check passed, but the first token of a triple is neither 'err' nor 'out'. Those two literals are the only supported stream selectors (stderr/stdout respectively); anything else cannot be bound to a counting PrintStream.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/debug/BenchmarkCounters.java:484

                            }
                        }
                        break;
                }
            }
        }

        if (Options.BenchmarkDynamicCounters.getValue(options) != null) {
            String[] arguments = Options.BenchmarkDynamicCounters.getValue(options).split(",");
            if (arguments.length == 0 || (arguments.length % 3) != 0) {
                throw new GraalError("invalid arguments to BenchmarkDynamicCounters: (err|out),start,end,(err|out),start,end,... (~ matches multiple digits)");
            }
            for (int i = 0; i < arguments.length; i += 3) {
                if (arguments[i].equals("err")) {
                    System.setErr(new PrintStream(new BenchmarkCountersOutputStream(System.err, arguments[i + 1], arguments[i + 2])));
                } else if (arguments[i].equals("out")) {
                    System.setOut(new PrintStream(new BenchmarkCountersOutputStream(System.out, arguments[i + 1], arguments[i + 2])));
                } else {
                    throw new GraalError("invalid arguments to BenchmarkDynamicCounters: err|out");
                }
            }
            enabled = true;
        }
        if (Options.GenericDynamicCounters.getValue(options)) {
            enabled = true;
        }
        if (Options.TimedDynamicCounters.getValue(options) > 0) {
            if (LibGraalSupport.inLibGraalRuntime()) {
                throw new GraalError("Use of %s is only supported in jargraal", Options.TimedDynamicCounters.getName());
            }
            Thread thread = new Thread(new Runnable() {
                long lastTime = System.nanoTime();

                @Override
                public void run() {
                    try (PrintStreamScope scope = getPrintStream(options)) {
                        while (true) { // TERMINATION ARGUMENT: busy waiting loop

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Use exactly 'err' or 'out' (lowercase) as the first token of every triple.
  2. Double-check the value parses as triples before launching, e.g. echo "$V" | awk -F, 'NF%3!=0{exit 1}'.

Example fix

# before
-Dgraal.BenchmarkDynamicCounters=stdout,1,~

# after
-Dgraal.BenchmarkDynamicCounters=out,1,~
Defensive patterns

Strategy: validation

Validate before calling

String[] toks = System.getProperty("graal.BenchmarkDynamicCounters", "").split(",");
for (int i = 0; i < toks.length; i += 3) {
    if (!toks[i].equals("err") && !toks[i].equals("out")) {
        throw new IllegalArgumentException("Triple " + (i / 3) + " stream must be 'err' or 'out': " + toks[i]);
    }
}

Prevention

When it happens

Trigger: Passing a triple whose first element is invalid, e.g. -Dgraal.BenchmarkDynamicCounters='both,1,~' or 'stdout,1,~' — note it must be exactly 'err' or 'out', case-sensitive.

Common situations: Writing 'stdout'/'stderr' in full instead of 'out'/'err'; uppercasing the token; copy-paste from docs that paraphrase the syntax.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/f5dda3539524ad5d. Report an issue: GitHub.