oracle/graal · error · RuntimeException

Allocator's housekeeping thread was interrupted.

Error message

Allocator's housekeeping thread was interrupted.

What it means

The ObjectPoolingAllocator's housekeeping thread runs a wait/housekeep loop; if the thread is interrupted while sleeping between housekeeping passes, the InterruptedException is wrapped in a RuntimeException and thrown, terminating the housekeeping thread. Pool pruning/cleanup then stops, which can let pooled memory accumulate until the allocator is shut down.

Source

Thrown at sdk/src/org.graalvm.collections/src/org/graalvm/collections/LockFreePrefixTree.java:1119

                        hashChildrenPreallocationTotal[sizeClass] += growthEstimate;
                    }
                }
            }

            @Override
            public void run() {
                while (isEnabled.get()) {
                    try {
                        synchronized (this) {
                            log("housekeeping thread sleeping... %d ms.", nextHousekeepingPeriodMillis);
                            this.wait(nextHousekeepingPeriodMillis);
                            // Decrease housekeeping period up to maximum using an exponential
                            // backoff.
                            nextHousekeepingPeriodMillis = Math.min(defaultHousekeepingPeriodMillis, nextHousekeepingPeriodMillis * 2);
                        }
                        housekeep();
                    } catch (InterruptedException e) {
                        throw new RuntimeException("Allocator's housekeeping thread was interrupted.", e);
                    }
                }
            }
        }
    }
}

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Do not interrupt the housekeeping thread directly; use shutdown() to stop it.
  2. Isolate the allocator's threads from bulk interrupt sweeps (name threads and exempt them, or run the tree in a dedicated thread group).
  3. If the exception surfaced during shutdown, treat it as benign but verify shutdown() completed; otherwise recreate the allocator instance.

Example fix

// before
Thread.getAllStackTraces().keySet().forEach(Thread::interrupt); // hits housekeeping thread

// after
alloc.shutdown(); // the only supported way to stop housekeeping
Defensive patterns

Strategy: try-catch

Try / catch

// In supervising code: verify housekeeping stopped after any interrupt storm
try {
    alloc.shutdown();
} catch (RuntimeException e) {
    if (!(e.getCause() instanceof InterruptedException)) throw e;
    // benign only during teardown; otherwise recreate allocator
}

Prevention

When it happens

Trigger: Anything calling Thread.interrupt() on the allocator's housekeeping thread — executor shutdownNow(), application shutdown logic that interrupts all non-daemon threads, or aggressive thread management in tests/containers.

Common situations: Running inside application servers or test frameworks that bulk-interrupt threads on redeploy/shutdown; calling shutdown() concurrently with an external interrupt; misbehaving libraries that interrupt unknown threads.

Related errors


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