{"record":{"id":"aa8ddb8ccf69fb15","repo":"stanfordnlp/CoreNLP","slug":"could-not-start-liveness-server-this-will-probabl","errorCode":null,"errorMessage":"Could not start liveness server. This will probably result in very bad things happening soon.","messagePattern":"Could not start liveness server\\. This will probably result in very bad things happening soon\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java","lineNumber":1713,"sourceCode":"   */\n  private void livenessServer(AtomicBoolean live) {\n    if (this.serverPort != this.statusPort) {\n      try {\n        // Create the server\n        if (this.ssl) {\n          server = addSSLContext(HttpsServer.create(new InetSocketAddress(statusPort), 0)); // 0 is the default 'backlog'\n        } else {\n          server = HttpServer.create(new InetSocketAddress(statusPort), 0); // 0 is the default 'backlog'\n        }\n        // Add the two status endpoints\n        withAuth(server.createContext(\"/live\", new LiveHandler()), Optional.empty());\n        withAuth(server.createContext(\"/ready\", new ReadyHandler(live)), Optional.empty());\n        // Start the server\n        server.start();\n        // Server started\n        log(\"Liveness server started at \" + server.getAddress());\n      } catch (IOException e) {\n        err(\"Could not start liveness server. This will probably result in very bad things happening soon.\", e);\n      }\n    }\n  }\n\n\n  /**\n   * Returns the implementing Http server.\n   */\n  public Optional<HttpServer> getServer() {\n    return Optional.ofNullable(server);\n  }\n\n\n\n  /** @see StanfordCoreNLPServer#run(Optional, Predicate, Consumer, StanfordCoreNLPServer.FileHandler, boolean, AtomicBoolean) */\n  @Override\n  public void run() {\n    // Set the static page handler","sourceCodeStart":1695,"sourceCodeEnd":1731,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java#L1695-L1731","documentation":"StanfordCoreNLPServer attempts to start a secondary HTTP liveness/ready server on a separate port and catches the IOException when it cannot bind or start. It logs this severe message because without the liveness endpoint, orchestration systems cannot detect server health. The main CoreNLP server may still run, so this is a serious but non-fatal warning.","triggerScenarios":"Invoking the server constructor (public StanfordCoreNLPServer) with a liveness port (-status_port) that is already in use, blocked by firewall, or otherwise unbindable, so server.start() on the liveness HttpServer throws IOException.","commonSituations":"Status port already occupied by another process or a previous un-terminated server instance; port below 1024 without privileges in containers; Docker/Kubernetes port collisions when scaling replicas on one host.","solutions":["Choose a free liveness port via -status_port (or 0 for ephemeral) and verify with `ss -ltnp | grep <port>`.","Kill the stale process holding the port or the previous StanfordCoreNLPServer instance.","If running in a container, ensure the status port is exposed/mapped and not bound twice across replicas.","Run with sufficient privileges if using a privileged port (<1024)."],"exampleFix":"// before: port 9001 already used by old instance\njava -cp ... StanfordCoreNLPServer -port 9000 -status_port 9001\n// after\nkill $(lsof -t -i:9001)\njava -cp ... StanfordCoreNLPServer -port 9000 -status_port 9005","handlingStrategy":"validation","validationCode":"int statusPort = 9001;\ntry (ServerSocket s = new ServerSocket()) {\n    s.setReuseAddress(true);\n    s.bind(new InetSocketAddress(statusPort)); // throws if taken\n} catch (IOException e) {\n    throw new IllegalStateException(\"Liveness port \" + statusPort + \" unavailable\", e);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick unique, high-numbered status ports per instance.","Check port availability in startup scripts before launching.","Ensure old instances are terminated in restart/deploy hooks."],"tags":["java","network","http-server","port-binding"],"backgroundTag":"address-already-in-use","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"}