mirror of
https://github.com/floci-io/floci.git
synced 2026-11-25 06:47:41 -05:00
* fix(ecr): retry occupied registry ports The backing registry reserved one port from the configured range and gave up when Docker refused to publish it, although the next port was free. The allocator's probe races `docker run`, and from inside a container it cannot see a host process holding the port, so a refusal is expected and not fatal. A start Docker refuses as a host-port collision now moves on to the next port in the range; any other failure still fails at once. Refused ports stay reserved until the start finishes so each is tried once, then are released. When the range runs out the error names the refused ports. EC2's collision check moves to PortAllocator so both callers share it. Closes floci-io/floci#4856 * chore(ecr): keep the port retry tests independent of host ports The unit tests now use an allocator that skips the host probe, so a busy 6100 or 6101 on the machine cannot change their outcome. The integration test picks its port pair with the Docker-aware allocator, so a container already publishing a port is skipped as well, and drops its logger. * docs(ecr): say other registry start errors still fail at once The paragraph said startup fails only when the range is full, but a daemon or image failure still fails without trying another port. The exhaustion tests now also allocate the last refused port, so releasing only some of them fails. * refactor(ec2,ecr): share the port retry loop in PortAllocator Review asked for the allocate, start and retry loop itself to live in one place, not just the collision check. PortAllocator.allocateAndStart takes the start as a callback, moves past ports Docker refuses as in use, and releases the refused ports when it returns. ECR and EC2 both call it. EC2 used to mark a refused SSH port reserved for the life of the process. It now releases it after the launch, as ECR does, so a port whose holder goes away is usable again. With the loop moved, a launch cancelled between attempts can now reach the worker's failure path. When Docker is also gone that path marked the instance running without a container, so it now goes through markRunning and leaves a cancelled instance terminated. * test: share one host-blind PortAllocator across the port tests PortAllocatorTest, EcrRegistryManagerTest and the ECR port-conflict integration test each built their own allocator that skips the host probe. HostBlindPortAllocator replaces the three copies.