stanfordnlp/CoreNLP · error

Could not start liveness server. This will probably result…

Error message

Could not start liveness server. This will probably result in very bad things happening soon.

What it means

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.

Solutions

  1. Choose a free liveness port via -status_port (or 0 for ephemeral) and verify with `ss -ltnp | grep <port>`.
  2. Kill the stale process holding the port or the previous StanfordCoreNLPServer instance.
  3. If running in a container, ensure the status port is exposed/mapped and not bound twice across replicas.
  4. Run with sufficient privileges if using a privileged port (<1024).

Example fix

// before: port 9001 already used by old instance
java -cp ... StanfordCoreNLPServer -port 9000 -status_port 9001
// after
kill $(lsof -t -i:9001)
java -cp ... StanfordCoreNLPServer -port 9000 -status_port 9005
Defensive patterns

Strategy: validation

Validate before calling

int statusPort = 9001;
try (ServerSocket s = new ServerSocket()) {
    s.setReuseAddress(true);
    s.bind(new InetSocketAddress(statusPort)); // throws if taken
} catch (IOException e) {
    throw new IllegalStateException("Liveness port " + statusPort + " unavailable", e);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java:1713

   */
  private void livenessServer(AtomicBoolean live) {
    if (this.serverPort != this.statusPort) {
      try {
        // Create the server
        if (this.ssl) {
          server = addSSLContext(HttpsServer.create(new InetSocketAddress(statusPort), 0)); // 0 is the default 'backlog'
        } else {
          server = HttpServer.create(new InetSocketAddress(statusPort), 0); // 0 is the default 'backlog'
        }
        // Add the two status endpoints
        withAuth(server.createContext("/live", new LiveHandler()), Optional.empty());
        withAuth(server.createContext("/ready", new ReadyHandler(live)), Optional.empty());
        // Start the server
        server.start();
        // Server started
        log("Liveness server started at " + server.getAddress());
      } catch (IOException e) {
        err("Could not start liveness server. This will probably result in very bad things happening soon.", e);
      }
    }
  }


  /**
   * Returns the implementing Http server.
   */
  public Optional<HttpServer> getServer() {
    return Optional.ofNullable(server);
  }



  /** @see StanfordCoreNLPServer#run(Optional, Predicate, Consumer, StanfordCoreNLPServer.FileHandler, boolean, AtomicBoolean) */
  @Override
  public void run() {
    // Set the static page handler

View on GitHub (pinned to 1b7edd19c4)