{"record":{"id":"ff5e0896fccc8061","repo":"stanfordnlp/CoreNLP","slug":"runtimeinterruptedexception-no-message","errorCode":null,"errorMessage":"RuntimeInterruptedException (no message)","messagePattern":"RuntimeInterruptedException \\(no message\\)","errorType":"exception","errorClass":"RuntimeInterruptedException","httpStatus":null,"severity":"warning","filePath":"src/edu/stanford/nlp/coref/statistical/StatisticalCorefAlgorithm.java","lineNumber":84,"sourceCode":"    this.maxMentionDistance = maxMentionDistance;\n    this.maxMentionDistanceWithStringMatch = maxMentionDistanceWithStringMatch;\n    this.thresholds = makeThresholds(thresholds);\n  }\n\n  private static Map<Pair<Boolean, Boolean>, Double> makeThresholds(double[] thresholds) {\n    Map<Pair<Boolean, Boolean>, Double> thresholdsMap = new HashMap<>();\n    thresholdsMap.put(new Pair<>(true, true), thresholds[0]);\n    thresholdsMap.put(new Pair<>(true, false), thresholds[1]);\n    thresholdsMap.put(new Pair<>(false, true), thresholds[2]);\n    thresholdsMap.put(new Pair<>(false, false), thresholds[3]);\n    return thresholdsMap;\n  }\n\n  @Override\n  public void runCoref(Document document) {\n    Compressor<String> compressor = new Compressor<>();\n    if (Thread.interrupted()) {  // Allow interrupting\n      throw new RuntimeInterruptedException();\n    }\n\n    Map<Pair<Integer, Integer>, Boolean> pairs = new HashMap<>();\n    for (Map.Entry<Integer, List<Integer>> e: CorefUtils.heuristicFilter(\n        CorefUtils.getSortedMentions(document),\n        maxMentionDistance, maxMentionDistanceWithStringMatch).entrySet()) {\n      for (int m1 : e.getValue()) {\n        pairs.put(new Pair<>(m1, e.getKey()), true);\n      }\n    }\n\n    DocumentExamples examples = extractor.extract(0, document, pairs, compressor);\n    Counter<Pair<Integer, Integer>> pairwiseScores = new ClassicCounter<>();\n    for (Example mentionPair : examples.examples) {\n      if (Thread.interrupted()) {  // Allow interrupting\n        throw new RuntimeInterruptedException();\n      }\n      pairwiseScores.incrementCount(new Pair<>(mentionPair.mentionId1, mentionPair.mentionId2),","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/coref/statistical/StatisticalCorefAlgorithm.java#L66-L102","documentation":"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.","triggerScenarios":"Thread.interrupted() returns true when runCoref(document) is invoked, typically because another thread called thread.interrupt() on the worker running coref.","commonSituations":"Cancelling a long-running CoreNLP pipeline via ExecutorService.shutdownNow(), pipeline timeouts, or user-initiated aborts in annotation servers.","solutions":["If cancellation was intended, let the exception propagate and clean up","If not intended, find who interrupted the thread (shutdownNow, timeout executor) and adjust lifecycle management","Run coref in a thread not shared with interrupt-driven cancellation logic"],"exampleFix":"// before\nexecutor.submit(() -> algorithm.runCoref(doc));\nexecutor.shutdownNow(); // interrupts mid-run\n// after\nFuture<?> f = executor.submit(() -> algorithm.runCoref(doc));\n// cancel deliberately and handle\nf.cancel(true);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  algorithm.runCoref(document);\n} catch (RuntimeInterruptedException e) {\n  Thread.currentThread().interrupt();\n  logger.info(\"coref cancelled before start\");\n}","preventionTips":["Keep coref runs on dedicated threads not subject to blanket shutdownNow()","Only interrupt workers when cancellation is intended","Preserve the interrupt status when catching"],"tags":["interruption","threading","cancellation","coref"],"backgroundTag":"request-timeout","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}