You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit eef5db6
Browse filesBrowse the repository at this point in the historyBrowse files
Docker: Skip busy ports when seeding a worktree's instance (#53935)
* Docker: skip busy host ports when seeding a worktree's instance
seed-worktree-env.sh now checks 127.0.0.1 for a listener before it hands
out a port, and moves to the next free one. Before, it could pick a port
another app (an SSH tunnel on 8080, say) was already using.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFjM4HdEDHT7uiZDdjhUMQ
* Docker: bound the port probe and check IPv6 localhost too
A listener with a full accept queue can drop the connect, so give each
probe about a second and treat a timeout as busy. Probe ::1 as well as
127.0.0.1. In the fixture test, compute expected ports before each run,
fail clearly if the test listener never binds, and use a larger backlog.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFjM4HdEDHT7uiZDdjhUMQ
* Docker: bound the fixture's port probe and test a full accept queue
The test's listening helper now gives up like the script does, and a new
case checks a listener with a full accept queue is skipped without
stalling the seeder. The README says reused ports are kept as is.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFjM4HdEDHT7uiZDdjhUMQ
* Docker: make the full-queue fixture case check its own setup
Fill the queue with listen(1) and confirm a fresh connect times out
before running the case, polling for the listener instead of a fixed
sleep. Where the OS still accepts the connect, the case is skipped.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MFjM4HdEDHT7uiZDdjhUMQ
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .agents/skills/work-on.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -385,7 +385,7 @@ Written by `checkpoint.sh` at every phase boundary; read by coordinators. Never
385
385
386
386
Main `jetpack_dev` uses: WP 80, phpMyAdmin 8181, Mailpit inbox 1080, Mailpit SMTP 25, SFTP 1022. The seeder allocates the first free value at or above a per-service base — WP `8080`, phpMyAdmin `8282`, inbox `1180`, SMTP `2525`, SFTP `2222` — so a first worktree usually lands exactly on those, and later ones step up from there. Values are persisted in the worktree's `tools/docker/.env` and stay stable across restarts.
387
387
388
-
The seeder reserves ports recorded in other worktrees' `.env` files, but does not probe for live-bound host ports and does not lock against two worktrees seeding at the same instant. A genuine clash surfaces as `address already in use` from `jp docker up` — edit the port in `tools/docker/.env` and retry, then update `.work-on/env.json` to match. See `tools/docker/README.md` § "Parallel development environments" for the authoritative rules.
388
+
The seeder skips ports recorded in other worktrees' `.env` files and ports that already have a listener on localhost, but does not lock against two worktrees seeding at the same instant. A genuine clash surfaces as `address already in use` from `jp docker up` — edit the port in `tools/docker/.env` and retry, then update `.work-on/env.json` to match. See `tools/docker/README.md` § "Parallel development environments" for the authoritative rules.
Copy file name to clipboardExpand all lines: tools/docker/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -169,7 +169,7 @@ This writes a unique `COMPOSE_PROJECT_NAME` (derived from git's worktree id —
169
169
-**idempotent** — it only fills in the keys that are missing (so it also backfills ports for a name-only `.env` left by `up --name`) and is a no-op once fully configured, so it's safe to run before every `up`;
170
170
-**a no-op in the primary checkout** — that always stays `jetpack_dev` on the default ports.
171
171
172
-
It reserves ports already recorded in other worktrees' `.env` files and the primary defaults, but does not probe for live-bound host ports, and does not lock against another worktree seeding at the same instant — so two worktrees seeded in parallel can, in principle, pick the same port. Either way a genuine clash surfaces when `jetpack docker up` reports `address already in use`; edit the port in `.env` and retry.
172
+
When it picks a new port, it skips ports already recorded in other worktrees' `.env` files, the primary defaults, and any port that already has a listener on localhost (`127.0.0.1` or `::1`). A port already in this worktree's `.env` is kept as is. It does not lock against another worktree seeding at the same instant, so two worktrees seeded in parallel can, in principle, pick the same port. A genuine clash surfaces when `jetpack docker up` reports `address already in use`; edit the port in `.env` and retry.
173
173
174
174
To undo it, delete the seeded lines from `tools/docker/.env` (the file is git-ignored and removed with the worktree). To set the name/ports yourself instead, edit `.env` by hand or use the manual flags below.
0 commit comments