ci: playwright webServer 反复 EADDRINUSE 导致零测试执行的假红——今天已撞两次(:::49648 / :::40916)
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 969
Description
## 现象
Playwright 的 `webServer` 起不来,job 红但**一条用例都没执行**:
```
[WebServer] ERROR [NestApplication] Error: listen EADDRINUSE: address already in use :::40916
Error: Process from config.webServer was not able to start. Exit code: 1
ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL playwright test --config playwright.fullstack-smoke.config.ts --project=seeded-github-import
```
今天两次(都不是同一个 PR 的问题):
- PR #3117 `fullstack-smoke`,job 102061898806,端口 `:::40916`
- F2 复核那趟,端口 `:::49648`
## 为什么值得单独立项
1. **它是「红 ≠ 跑过」的一种**:job 级红读起来像「测试失败」,实际零执行。今天已因此误判过一次(把它当成 F2 的结果)。
2. **#3043(`92b06a316` listen(0) 一律绑回环 + 机械门控)没有覆盖这条路径**:它改的是 155 个测试文件里的 `listen(0)` 绑定地址,而这里是 **playwright `webServer` 启动的 Nest 应用**在端口上撞车——两者是不同的分配路径。
3. 每撞一次就浪费一整趟 CI(本仓 runner 已经紧张,#3091)。
## 要查的
- `webServer` 的端口从哪来(固定?随机?由谁分配?),同一 runner 上并行的 project/分片会不会拿到同一个。
- 若是「先探测空闲端口再启动」的经典 TOCTOU,改成让内核分配后由子进程回报实际端口(`listen(0)` + 读回 `address().port`),或给每个 project 一段互不重叠的端口区间。
- 加一条机械门控:`webServer` 启动失败时**输出必须明确写「零测试执行」**,别让 job 级红被读成测试失败。
## 相关
#3043(listen(0) 绑定地址,已合但不覆盖本路径)、#3091(runner 拥堵)、#3047(车道无逐测试隔离)。
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with playwright.fullstack-smoke.config.ts and trace how webServer obtains its port for parallel projects and shards. Reproduce the failure with the shown Playwright command, then compare the path with #3043's listen(0) changes. Done means preventing port collisions or reliably reporting the assigned port, plus a startup-failure message that explicitly says zero tests executed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- playwright, typescript
- Domain
- ci-cd, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100