Files
floci/src/main/java/io
Allen Sanborn 2e09bb4efa fix(lambda): skip Runtime API ports held by other processes (#4969)
* fix(lambda): skip Runtime API ports held by other processes

PortAllocator only tracked ports handed out inside its own JVM. When
another process in the same network namespace held the lowest port of the
range, allocate() returned it anyway and RuntimeApiServer retried the same
bind for 5s before the cold start failed, while the rest of the range sat
idle. Probe each candidate by binding 0.0.0.0 (as RuntimeApiServer does)
and fall through to the next port; a held port is not kept reserved, so it
is handed out again once its holder lets go.

* fix(lambda): keep Runtime API port tests off host ports

The exhaustion message now says a port may be in use by this floci or
held by another process, since allocate() skips externally held ports and
the pool can run dry with few of its own ports out.

Pool-bookkeeping tests ran on 9200-9299 (OpenSearch's port) and 12000+,
which the bindability probe now binds for real. Make the probe injectable
through the package-private constructor and pass an always-bindable one
there, so those tests no longer depend on what is listening on the host.
The held-port test keeps the real probe and skips itself when the OS hands
out a port too close to 65535 for its range. Rewrap the class Javadoc.
2026-10-02 22:37:14 -04:00
..