flyctl v0.4.118, darwin/arm64, app in fra.
To reproduce, tail an app’s logs, then start a Machine that prints one line a second for a minute:
LOG_LEVEL=debug fly logs -a <app> --json
fly machine run alpine:3 -a <app> --region fra --restart no --rm --detach -- \
sh -c 'for i in $(seq 1 60); do echo tick $i; sleep 1; done'
I tried this three times today. The tail showed ticks 1 to 17 the first time, 1 to 9 the second, and none the third. Each time the fly logs process kept running and printed nothing more. fly logs --no-tail straight after showed all 60 ticks.
The debug output from the third try shows flyctl polling GET /api/v1/apps/<app>/logs?next_token=1792783284795362836 about every 6 seconds. Every answer was {"data":[],"meta":{"next_token":""}}. About two minutes after the Machine finished, I sent the same request with the same next_token by hand and got 74 entries, the ticks among them. So the lines were stored, but the API returned nothing for that position while the tail was asking.
In longer sessions, fly logs also exits on its own every 8 minutes or so, with exit code 0 and no message.
For now we poll fly logs --no-tail every 10 seconds and drop lines we’ve already seen. This may be the same problem as fly logs hangs periodically · Issue #515 · superfly/flyctl · GitHub.