CI flake: migrations job MySQL service publishes fixed host port 3306 — concurrent runs collide #149

Closed
opened 2026-07-07 11:59:03 +02:00 by timothy · 1 comment
Owner

Observed 2026-07-07 on run 550 (PR #76 rebase): EF migration integrity failed with Bind for 0.0.0.0:3306 failed: port is already allocated because run 549 was executing its own migrations job at the same time.

Root cause: .gitea/workflows/docker-build.yml migrations job declares

services:
  mysql:
    ports:
      - 3306:3306

The fixed host-port publish makes concurrent runs mutually exclusive. The job connects via the service name (Server=mysql) on the runner docker network, so the host publish is probably unnecessary — try removing ports: (or use an ephemeral mapping) and verify the MySql drift/apply steps still pass.

Workaround used: retriggered via empty commit once the other run finished.

Observed 2026-07-07 on run 550 (PR #76 rebase): `EF migration integrity` failed with `Bind for 0.0.0.0:3306 failed: port is already allocated` because run 549 was executing its own migrations job at the same time. Root cause: `.gitea/workflows/docker-build.yml` migrations job declares ```yaml services: mysql: ports: - 3306:3306 ``` The fixed host-port publish makes concurrent runs mutually exclusive. The job connects via the service name (`Server=mysql`) on the runner docker network, so the host publish is probably unnecessary — try removing `ports:` (or use an ephemeral mapping) and verify the MySql drift/apply steps still pass. Workaround used: retriggered via empty commit once the other run finished.
timothy added the bugci-cdpriority: medium labels 2026-07-11 19:03:43 +02:00
Author
Owner

Resolved — fixed on main by ef8915f1 (ci: unpin MySQL service host port 3306 (concurrent-run collision)).

Root cause: the migrations job's mysql:8.4 service published host port 3306. Two migrations jobs overlapping on the same runner both tried to bind it → "port is already allocated", failing whichever run started second.

Fix: removed the host-port binding entirely. The job reaches MySQL over the shared runner network as mysql:3306 (MySql__ConnectionString=Server=mysql;Port=3306;...), so concurrent runs no longer contend for a host port. Documented inline in .gitea/workflows/docker-build.yml.

Verified: builds no longer fail on overlapping ports. Closing as fixed.

**Resolved** — fixed on `main` by `ef8915f1` (*ci: unpin MySQL service host port 3306 (concurrent-run collision)*). **Root cause:** the `migrations` job's `mysql:8.4` service published host port `3306`. Two migrations jobs overlapping on the same runner both tried to bind it → `"port is already allocated"`, failing whichever run started second. **Fix:** removed the host-port binding entirely. The job reaches MySQL over the shared runner network as `mysql:3306` (`MySql__ConnectionString=Server=mysql;Port=3306;...`), so concurrent runs no longer contend for a host port. Documented inline in `.gitea/workflows/docker-build.yml`. Verified: builds no longer fail on overlapping ports. Closing as fixed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: timothy/ersatztv#149