apache/seatunnel · critical · RuntimeException

Jetty failed to start, No available port found in the range!

Error message

Jetty failed to start, No available port found in the range!

What it means

JettyService.chooseAppropriatePort scans the configured port range (port, port+1, ...) trying to find a free port for the embedded Jetty web server and throws a RuntimeException when every port in the range is occupied. The web UI/HTTP service cannot bind and will fail to start.

Solutions

  1. Free the ports: find holders with `ss -ltnp | grep <port>` or `lsof -i :<port>` and kill stale processes.
  2. Widen the port range or change the base port in the Jetty/web (http) configuration in seatunnel.yaml (e.g. http port 8080 with a larger fallback range).
  3. Restart on a machine with fewer port conflicts, or reserve a distinct port range for SeaTunnel in your environment.

Example fix

// before (seatunnel.yaml)
web:
  port: 8080
// after: pick a free base port / wider range
web:
  port: 18080
  # ensure 18080-18089 are not used: ss -ltn 'sport >= :18080 and sport <= :18089'
Defensive patterns

Strategy: validation

Validate before calling

# verify the configured port range is free before starting the node
ss -ltn 'sport >= :8080 and sport <= :8090' || netstat -ltn | awk '$4 ~ /:808[0-9]$/'
# any output means the range is taken — pick another base port

Try / catch

try {
    jettyService.start();
} catch (RuntimeException e) {
    if (e.getMessage().contains("No available port found")) {
        log.error("All Jetty ports occupied; free ports or change http.port in seatunnel.yaml");
    }
    throw e;
}

Prevention

When it happens

Trigger: All ports in the configured HTTP port range are in use by other processes (or by leftover Jetty instances from previous unclean shutdowns) when the node starts its JettyService.

Common situations: Running many Zeta nodes on one machine with a narrow port range; port range conflicts with other services (app servers, monitoring agents); zombie processes from a previous crash still holding sockets (check with ss -ltnp).

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/f194263bcb867566. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/JettyService.java:310

            throw new RuntimeException(e);
        }
    }

    private static String convertUrlToPath(String url) {
        return url + "/*";
    }

    public int chooseAppropriatePort(int initialPort, int portRange) {
        int port = initialPort;

        while (port <= initialPort + portRange) {
            if (!isPortInUse(port)) {
                return port;
            }
            port++;
        }

        throw new RuntimeException("Jetty failed to start, No available port found in the range!");
    }

    private boolean isPortInUse(int port) {
        try (ServerSocket ss = new ServerSocket(port);
                DatagramSocket ds = new DatagramSocket(port)) {
            return false;
        } catch (IOException e) {
            return true;
        }
    }
}

View on GitHub (pinned to cf67b549a7)