{"record":{"id":"f1ea650ca27d9ae5","repo":"stanfordnlp/CoreNLP","slug":"never-got-readiness-from-annotator","errorCode":null,"errorMessage":"Never got readiness from annotator: ","messagePattern":"Never got readiness from annotator: ","errorType":"exception","errorClass":"TimeoutException","httpStatus":null,"severity":"critical","filePath":"src/edu/stanford/nlp/pipeline/WebServiceAnnotator.java","lineNumber":278,"sourceCode":"      if (System.currentTimeMillis() > startTime + CONNECT_TIMEOUT) {\n        throw new TimeoutException(\"Could not connect to annotator: \" + this);\n      }\n      if (!live()) {\n        try {\n          Thread.sleep(1000);\n        } catch (InterruptedException ignored) {}\n      } else {\n        everLive = true;\n      }\n    }\n    log.info(\"Got liveness from server for \" + this);\n\n    // 3. Wait for the target server to become ready\n    synchronized (this) {\n      if (this.server.isPresent()) {\n        while (!this.server.get().ready) {\n          if (System.currentTimeMillis() > startTime + CONNECT_TIMEOUT) {\n            throw new TimeoutException(\"Never got readiness from annotator: \" + this);\n          }\n          if (!ready(true)) {\n            try {\n              Thread.sleep(1000);\n            } catch (InterruptedException ignored) {\n            }\n          } else {\n            this.server.get().ready = true;\n          }\n        }\n      } else if (!ready(false)) { // The server is not ready\n        throw new IOException(\"Server is not ready and can not start it!\");\n      }\n    }\n    log.info(\"Got readiness from server for \" + this);\n    serverWasActive = true;\n\n    // 4. Server is ensured! We can continue","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/WebServiceAnnotator.java#L260-L296","documentation":"After the server is live, WebServiceAnnotator.ensureServer waits for the server's own readiness signal (server.ready / ready(true)). If readiness is never reported within CONNECT_TIMEOUT, it throws this TimeoutException.","triggerScenarios":"The server process is up and answering connections but its readiness check never returns true within the timeout — e.g. the service reports liveness before models finish loading, or the readiness endpoint is unreachable while the main endpoint is not.","commonSituations":"Slow model warm-up exceeding the timeout, a readiness endpoint path misconfigured, server started externally (no managed server object) so readiness must come from polling ready(false/true), or hung initialization in the service.","solutions":["Increase the connect/readiness timeout so slow initialization can complete","Confirm the service's readiness/health endpoint actually flips to ready (curl the health path)","Check service logs for initialization errors or deadlocks during warm-up","Restart the service; if readiness is never signalled even when healthy, update the annotator configuration to point at the correct health URL"],"exampleFix":"// before\nWebServiceAnnotator a = new WebServiceAnnotator(props); // default short timeout\n// after\nprops.setProperty(\"webservice.connectTimeout\", \"300000\");\nWebServiceAnnotator a = new WebServiceAnnotator(props);","handlingStrategy":"retry","validationCode":"// Poll the health endpoint until ready before using the annotator\nlong deadline = System.currentTimeMillis() + 300_000;\nwhile (System.currentTimeMillis() < deadline) {\n  try {\n    int code = ((java.net.HttpURLConnection) new java.net.URL(healthUrl).openConnection()).getResponseCode();\n    if (code == 200) break;\n  } catch (java.io.IOException ignored) {}\n  try { Thread.sleep(1000); } catch (InterruptedException ignored) {}\n}","typeGuard":null,"tryCatchPattern":"try {\n  pipeline.annotate(doc);\n} catch (java.util.concurrent.TimeoutException e) {\n  if (e.getMessage().contains(\"Never got readiness\")) {\n    log.error(\"Server live but not ready in time: check health endpoint and init logs\");\n  }\n}","preventionTips":["Set a readiness timeout larger than the service's worst-case warm-up time","Verify the readiness/health endpoint returns ready=true manually","Look for initialization hangs or errors in service logs","Restart the service if readiness has been stuck; escalate if reproducible"],"tags":["web-service","timeout","readiness"],"backgroundTag":"request-timeout","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}