stanfordnlp/CoreNLP · warning · RuntimeInterruptedException

RuntimeInterruptedException (no message)

Error message

RuntimeInterruptedException (no message)

What it means

At the start of runCoref, StatisticalCorefAlgorithm checks Thread.interrupted() and throws RuntimeInterruptedException to allow cooperative cancellation of coreference resolution. It signals that the thread running the algorithm was interrupted before processing began.

Solutions

  1. If cancellation was intended, let the exception propagate and clean up
  2. If not intended, find who interrupted the thread (shutdownNow, timeout executor) and adjust lifecycle management
  3. Run coref in a thread not shared with interrupt-driven cancellation logic

Example fix

// before
executor.submit(() -> algorithm.runCoref(doc));
executor.shutdownNow(); // interrupts mid-run
// after
Future<?> f = executor.submit(() -> algorithm.runCoref(doc));
// cancel deliberately and handle
f.cancel(true);
Defensive patterns

Strategy: try-catch

Try / catch

try {
  algorithm.runCoref(document);
} catch (RuntimeInterruptedException e) {
  Thread.currentThread().interrupt();
  logger.info("coref cancelled before start");
}

Prevention

When it happens

Trigger: Thread.interrupted() returns true when runCoref(document) is invoked, typically because another thread called thread.interrupt() on the worker running coref.

Common situations: Cancelling a long-running CoreNLP pipeline via ExecutorService.shutdownNow(), pipeline timeouts, or user-initiated aborts in annotation servers.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/ff5e0896fccc8061. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/coref/statistical/StatisticalCorefAlgorithm.java:84

    this.maxMentionDistance = maxMentionDistance;
    this.maxMentionDistanceWithStringMatch = maxMentionDistanceWithStringMatch;
    this.thresholds = makeThresholds(thresholds);
  }

  private static Map<Pair<Boolean, Boolean>, Double> makeThresholds(double[] thresholds) {
    Map<Pair<Boolean, Boolean>, Double> thresholdsMap = new HashMap<>();
    thresholdsMap.put(new Pair<>(true, true), thresholds[0]);
    thresholdsMap.put(new Pair<>(true, false), thresholds[1]);
    thresholdsMap.put(new Pair<>(false, true), thresholds[2]);
    thresholdsMap.put(new Pair<>(false, false), thresholds[3]);
    return thresholdsMap;
  }

  @Override
  public void runCoref(Document document) {
    Compressor<String> compressor = new Compressor<>();
    if (Thread.interrupted()) {  // Allow interrupting
      throw new RuntimeInterruptedException();
    }

    Map<Pair<Integer, Integer>, Boolean> pairs = new HashMap<>();
    for (Map.Entry<Integer, List<Integer>> e: CorefUtils.heuristicFilter(
        CorefUtils.getSortedMentions(document),
        maxMentionDistance, maxMentionDistanceWithStringMatch).entrySet()) {
      for (int m1 : e.getValue()) {
        pairs.put(new Pair<>(m1, e.getKey()), true);
      }
    }

    DocumentExamples examples = extractor.extract(0, document, pairs, compressor);
    Counter<Pair<Integer, Integer>> pairwiseScores = new ClassicCounter<>();
    for (Example mentionPair : examples.examples) {
      if (Thread.interrupted()) {  // Allow interrupting
        throw new RuntimeInterruptedException();
      }
      pairwiseScores.incrementCount(new Pair<>(mentionPair.mentionId1, mentionPair.mentionId2),

View on GitHub (pinned to 1b7edd19c4)