aeron-io/aeron · error · BindException
no available ports in range
Error message
no available ports in range ${lowPort} ${highPort} What it means
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.
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.
Example fix
// before
WildcardPortManager mgr = new WildcardPortManager("20000-20010", ...);
// after
WildcardPortManager mgr = new WildcardPortManager("20000-30000", ...); Defensive patterns
Strategy: retry
Validate before calling
// pre-check host usage
Process p = Runtime.getRuntime().exec("ss -uln"); // confirm range ports are free before startup Try / catch
try { port = portManager.allocate(...); } catch (BindException e) { log.warn("port range exhausted, widening or retrying"); /* widen range or retry after closing idle channels */ } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- uses the same id as
- exceeded session limit, streamId=
- invalid port value
- :low port value must be lower than high port value
- mtuLength= > MAX_UDP_PAYLOAD_LENGTH=
AI-assisted analysis of aeron-io/aeron@6d60124e15 (2026-09-12).
Data as JSON: /api/errors/13e470ee871ad2a2.
Report an issue: GitHub.
Appendix: source
Thrown at aeron-driver/src/main/java/io/aeron/driver/media/WildcardPortManager.java:167
for (int i = lowPort; i < nextPort; i++)
{
if (!portSet.contains(i))
{
return i;
}
}
return 0;
}
private int allocateOpenPort() throws BindException
{
final int port = findOpenPort();
if (0 == port)
{
throw new BindException("no available ports in range " + this.lowPort + " " + this.highPort);
}
nextPort = port + 1;
if (nextPort > highPort)
{
nextPort = lowPort;
}
portSet.add(port);
return port;
}
}
View on GitHub (pinned to 6d60124e15)