eclipse-vertx/vert.x · error · IllegalArgumentException

Expecting a stripesCount that is larger than 0

Error message

Expecting a stripesCount that is larger than 0

What it means

The internal StripedLockFreePool of Vert.x's HybridJacksonPool (the reusable parser pool behind the JSON DatabindCodec) requires a positive stripe count. Constructing it with 0 or a negative value fails fast with IllegalArgumentException, since striping with no stripes is meaningless.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/json/jackson/HybridJacksonPool.java:88

    }
    // the native thread pool is based on ThreadLocal, so it doesn't have anything to do on release
  }

  public static class StripedLockFreePool implements RecyclerPool<BufferRecycler> {

    private static final int CACHE_LINE_SHIFT = 4;

    private static final int CACHE_LINE_PADDING = 1 << CACHE_LINE_SHIFT;

    private final XorShiftThreadProbe threadProbe;

    private final AtomicReferenceArray<Node> topStacks;

    private final int stripesCount;

    public StripedLockFreePool(int stripesCount) {
      if (stripesCount <= 0) {
        throw new IllegalArgumentException("Expecting a stripesCount that is larger than 0");
      }

      this.stripesCount = stripesCount;
      int size = roundToPowerOfTwo(stripesCount);
      this.topStacks = new AtomicReferenceArray<>(size * CACHE_LINE_PADDING);

      int mask = (size - 1) << CACHE_LINE_SHIFT;
      this.threadProbe = new XorShiftThreadProbe(mask);
    }

    public int size() {
      return stackSizes().sum();
    }

    public int[] stackStats() {
      return stackSizes().toArray();
    }

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Fix the configuration/property feeding the stripe count to be >= 1
  2. Clamp computed sizes: Math.max(1, computedSize) before constructing the pool
  3. Use the default HybridJacksonPool configuration instead of overriding it
  4. If constructing directly in tests, pass a positive value (e.g. number of CPUs)

Example fix

// before
int stripes = Integer.getInteger("pool.stripes", 0);
new StripedLockFreePool(stripes); // IllegalArgumentException
// after
int stripes = Math.max(1, Integer.getInteger("pool.stripes", Runtime.getRuntime().availableProcessors()));
new StripedLockFreePool(stripes);
Defensive patterns

Strategy: validation

Validate before calling

if (stripesCount <= 0) throw new IllegalArgumentException("stripesCount must be > 0");
new HybridJacksonPool.StripedLockFreePool(stripesCount);

Try / catch

try {
  pool = new HybridJacksonPool.StripedLockFreePool(stripes);
} catch (IllegalArgumentException e) {
  pool = new HybridJacksonPool.StripedLockFreePool(Runtime.getRuntime().availableProcessors());
}

Prevention

When it happens

Trigger: Instantiating HybridJacksonPool.StripedLockFreePool with stripesCount <= 0 — typically via custom pool sizing configuration (e.g. a capacity/threads-derived system property resolving to 0 or negative) or direct misuse of the internal class.

Common situations: Setting a system property such as vertx.jacksonPool size to 0 or a negative number; computing pool size from Runtime.getRuntime().availableProcessors() on an exotic/containerized JVM that reports 0; tests constructing the pool directly with 0.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06). Data as JSON: /api/errors/c25c5aace40116a9. Report an issue: GitHub.