🐛 tunnel diag: Docker log collection deadlocks when the container's stderr log exceeds 64 KiB
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start with diagnostic/log_collector_utils.go and inspect PipeCommandOutputToFile, then check how the host and Kubernetes collectors in log_collector_host.go and log_collector_kubernetes.go use it. Reproduce with Docker logs exceeding 65,536 bytes on stderr and verify both streams are collected without a timeout; confirm the shared diagnostic jobs complete afterward.
Written by the indexing model from the issue text.
Description
Version: cloudflared 2026.9.3 (the same code is on master today), cloudflared tunnel diag --metrics localhost:<port> --diag-container-id <container>, Linux.
What happens: "log information" fails with error waiting from command 'docker logs --tail 10000 --since <t> <container>': signal: killed after 45 s. Because every job shares the one 45 s context in RunDiagnostic, the jobs after it (raw network information, network information, cli configuration, configuration) also fail with context deadline exceeded.
Cause: diagnostic/log_collector_utils.go, PipeCommandOutputToFile, opens both StdoutPipe and StderrPipe, then io.Copys stdout to EOF before it starts reading stderr. cloudflared writes its log to stderr, so docker logs replays it on stderr. Once more than the pipe buffer (64 KiB on Linux) is pending on stderr, docker logs blocks writing stderr, never closes stdout, and the stdout copy waits until the context kills the process.
Reproduce: run diag against any Docker connector whose docker logs <container> 2>&1 >/dev/null | wc -c is above 65,536. Ours: 160,835 bytes on stderr, 0 on stdout → deadlock every time; another connector with 9,222 bytes → succeeds.
Workaround we used: a docker wrapper earlier in PATH: exec /path/to/real/docker "$@" 2>&1.
Suggested fix: read both pipes concurrently, or set command.Stdout and command.Stderr to the same *os.File (exec then copies both without a reader race), e.g. command.Stdout = outputHandle; command.Stderr = outputHandle; err := command.Run(). The same function serves the host and Kubernetes collectors (log_collector_host.go, log_collector_kubernetes.go), so kubectl logs would deadlock the same way.
- Dominant language
- Go
- Stars
- 16.3k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudflare/cloudflared
-
🐛 --output json writes invalid JSON lines when events are logged concurrentlyPossibly taken @theolujay claimed this 23 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/cloudflared#1761 · 5 comments ·
Maintainers usually reply within 1 day
-
🐛 cfRay is missing from proxied request logs (newHTTPLogger discards the zerolog context)Possibly taken @pankajc46 claimed this 25 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
cloudflare/cloudflared#1756 · 1 comment ·
Maintainers usually reply within 1 day
-
🐛 After SIGTERM, `cloudflared tunnel run` uses 100% of one CPU core for the whole graceful-shutdown periodPossibly taken @cyphercodes claimed this 26 days ago. OpenPriority: Normal Type: Bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
cloudflare/cloudflared#1753 · 3 comments ·
Maintainers usually reply within 1 day
-
tunnel route ip show: --filter-network-is-subset-of sends the superset filterPossibly taken @wangyusheng1985 claimed this 26 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
cloudflare/cloudflared#1750 ·
Maintainers usually reply within 1 day
-
🐛 QUIC Hijack() skips the status-written check that HTTP/2 enforcesPossibly taken @dedsec-terminal claimed this 19 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/cloudflared#1748 · 1 comment ·
Maintainers usually reply within 1 day
All issues in cloudflare/cloudflared
Similar issues
-
Fix mode unpins a reusable workflow call when the same repository is also used as a step actionOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
github/gh-actions-lock#261 ·
Maintainers usually reply within 1 day
-
bug documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
labmonkeys-space/nl6#974 ·
Maintainers usually reply within 1 day
-
model:sonnet phase-2-optimize runtime:claude security size:S
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
FootprintAI/Containarium#3471 ·
Maintainers usually reply within 1 day
-
[BUG] serviceenvupdater filter does not update KUBERNETES_SERVICE_HOST/PORT in init containersPossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openyurtio/openyurt#2845 ·
Maintainers usually reply within 7 days
-
fuzz.yml skips three fuzz targets, and the Action's user input describes only ~/.claudePossibly taken @predictor2718 claimed this today. Opengithub_actions P3 tests
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day