{"record":{"id":"f194263bcb867566","repo":"apache/seatunnel","slug":"jetty-failed-to-start-no-available-port-found-in","errorCode":null,"errorMessage":"Jetty failed to start, No available port found in the range!","messagePattern":"Jetty failed to start, No available port found in the range!","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/JettyService.java","lineNumber":310,"sourceCode":"            throw new RuntimeException(e);\n        }\n    }\n\n    private static String convertUrlToPath(String url) {\n        return url + \"/*\";\n    }\n\n    public int chooseAppropriatePort(int initialPort, int portRange) {\n        int port = initialPort;\n\n        while (port <= initialPort + portRange) {\n            if (!isPortInUse(port)) {\n                return port;\n            }\n            port++;\n        }\n\n        throw new RuntimeException(\"Jetty failed to start, No available port found in the range!\");\n    }\n\n    private boolean isPortInUse(int port) {\n        try (ServerSocket ss = new ServerSocket(port);\n                DatagramSocket ds = new DatagramSocket(port)) {\n            return false;\n        } catch (IOException e) {\n            return true;\n        }\n    }\n}\n","sourceCodeStart":292,"sourceCodeEnd":322,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/JettyService.java#L292-L322","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Free the ports: find holders with `ss -ltnp | grep <port>` or `lsof -i :<port>` and kill stale processes.","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).","Restart on a machine with fewer port conflicts, or reserve a distinct port range for SeaTunnel in your environment."],"exampleFix":"// before (seatunnel.yaml)\nweb:\n  port: 8080\n// after: pick a free base port / wider range\nweb:\n  port: 18080\n  # ensure 18080-18089 are not used: ss -ltn 'sport >= :18080 and sport <= :18089'","handlingStrategy":"validation","validationCode":"# verify the configured port range is free before starting the node\nss -ltn 'sport >= :8080 and sport <= :8090' || netstat -ltn | awk '$4 ~ /:808[0-9]$/'\n# any output means the range is taken — pick another base port","typeGuard":null,"tryCatchPattern":"try {\n    jettyService.start();\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"No available port found\")) {\n        log.error(\"All Jetty ports occupied; free ports or change http.port in seatunnel.yaml\");\n    }\n    throw e;\n}","preventionTips":["Reserve a dedicated port range for SeaTunnel web/HTTP ports in your environment","Check for stale processes after crashes (ss -ltnp / lsof -i) before restarting","Widen the fallback range when running many nodes per host"],"tags":["jetty","port-binding","network","zeta-engine"],"backgroundTag":"address-already-in-use","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}