{"record":{"id":"13e470ee871ad2a2","repo":"aeron-io/aeron","slug":"no-available-ports-in-range-lowport-highport","errorCode":null,"errorMessage":"no available ports in range ${lowPort} ${highPort}","messagePattern":"no available ports in range (.+?) (.+?)","errorType":"exception","errorClass":"BindException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/media/WildcardPortManager.java","lineNumber":167,"sourceCode":"\n        for (int i = lowPort; i < nextPort; i++)\n        {\n            if (!portSet.contains(i))\n            {\n                return i;\n            }\n        }\n\n        return 0;\n    }\n\n    private int allocateOpenPort() throws BindException\n    {\n        final int port = findOpenPort();\n\n        if (0 == port)\n        {\n            throw new BindException(\"no available ports in range \" + this.lowPort + \" \" + this.highPort);\n        }\n\n        nextPort = port + 1;\n        if (nextPort > highPort)\n        {\n            nextPort = lowPort;\n        }\n\n        portSet.add(port);\n\n        return port;\n    }\n}\n","sourceCodeStart":149,"sourceCodeEnd":181,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/media/WildcardPortManager.java#L149-L181","documentation":"allocateOpenPort scans the configured wildcard port range for a UDP channel that can be bound. If findOpenPort() returns 0, meaning no port in [lowPort, highPort] could be opened, a BindException is thrown indicating the range is exhausted.","triggerScenarios":"All ports in the configured range are in use (by this driver's own channels, other drivers on the same host, or other processes), or the range is too small for the number of concurrent publications/images.","commonSituations":"Running multiple Aeron drivers on one machine sharing the same wildcard range, long-lived applications leaking channels, or containers/NAT environments where the visible free ports differ from the configured range.","solutions":["Widen the wildcard port range (e.g. '20000-40000') so more concurrent channels can bind.","Check with 'ss -ul' or 'netstat -ul' which processes hold the range ports and stop the conflicting process.","Reuse/close publications when done so bound ports are released back to the manager.","Give each driver instance on a host a disjoint port range."],"exampleFix":"// before\nWildcardPortManager mgr = new WildcardPortManager(\"20000-20010\", ...);\n// after\nWildcardPortManager mgr = new WildcardPortManager(\"20000-30000\", ...);","handlingStrategy":"retry","validationCode":"// pre-check host usage\nProcess p = Runtime.getRuntime().exec(\"ss -uln\"); // confirm range ports are free before startup","typeGuard":null,"tryCatchPattern":"try { port = portManager.allocate(...); } catch (BindException e) { log.warn(\"port range exhausted, widening or retrying\"); /* widen range or retry after closing idle channels */ }","preventionTips":["Size the range generously vs expected concurrent channel count","Give each driver on a host a disjoint range","Close publications promptly to recycle ports","Monitor bound-port count in production"],"tags":["java","aeron-driver","udp","port-exhaustion"],"backgroundTag":"address-already-in-use","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}