Fly Proxy resets a stalled HTTP stream after ~30s on edge and Flycast hops; http_options.idle_timeout has no effect

Hello fly.io team. I’ve been trying to get Navidrome+Symfonium working smoothly while hosted on fly.io, and it mostly works, but has some unexpected drops when streaming: the connection sometimes drops around 30 seconds but doesn’t actually error, causing Symfonium to get an empty stream and mistakenly believe it’s valid track.

I’ve been investigating with Claude Code + Opus 5.5’s help and we’ve narrowed it down a fair bit, and I believe we’ve mitigated the problem (we detect the failure and actually throw an exception instead of failing silently), but it’d be nice to not have to do that.

The rest below was generated by Claude, but I can try to help too.


We’re seeing Fly Proxy reset proxied streams that stop making progress for about 30 seconds, and the documented idle_timeout setting doesn’t change it. Staff answers here describe a 60s idle timeout (1, 2), so we’d like to know whether this is a separate timer, and whether it’s configurable.

Setup (region sjc)

  • A public gateway app (http_service, ports 80/443, auto_stop_machines = "suspend") reverse-proxies to backend apps over Flycast (http://<app>.flycast). The backend apps have private IPs only, with services on 80 (http) and 443 (tls, http).
  • The gateway is Jetty (Java). It stops reading from the backend when its client stops reading (normal TCP backpressure), so a slow client stalls both hops.
  • We ruled out our own timeouts. Jetty logs Idle timeout expired when its own timer fires, and these breaks were a peer’s Broken pipe and Connection reset. The gateway’s HTTP client has no read timeout, and the backend’s Go http.Server sets only ReadHeaderTimeout.

Reproduction

The client downloads a 52 MB file through the public hostname, reads 10 MB, stops reading for N seconds, then resumes.

Stall HTTP/1.1 client HTTP/2 client
20s, 25s, 28s complete complete
32s edge closes the gateway’s inbound connection ~35s into the request (Broken pipe on the gateway’s write) gateway’s outbound Flycast connection is reset (SocketException: Connection reset)
60s same, at 35.1s same
120s — edge closes the gateway’s inbound connection at 31.7s

So something resets a connection that has made no progress for about 30 seconds, on the edge hop and the Flycast hop alike. Which one fires first varies between runs. After the edge-side cut, the HTTP/1.1 client was left hanging with no data and no FIN until its own 45s timeout.

We first saw this in production, with a real Android music player that pauses reading once its buffer is full. It produced the same Flycast-hop reset 5 times in a week.

What we tried

We set http_options.idle_timeout = 600 through the Machines API on every port of both machines (gateway and backend) and confirmed it in the machine config. Nothing changed. The 60s and 120s HTTP/2 stalls still reset the Flycast hop, and the 60s HTTP/1.1 stall was still cut at 35.2s.

Questions

  1. Is there a ~30s “no progress” timer in Fly Proxy, separate from idle_timeout?
  2. Can it be configured, per app or per service, including for Flycast traffic?
  3. Is it expected that an HTTP/1.1 client is left open with no FIN after the edge gives up on its upstream?

Hey there,

Thanks for sharing all the detail that you did! It looks like you’re hitting a separate connection level timeout that can kick in when a stream stops making progress for around 30 seconds. Which is separate from http_options.idle_timeout, so bumping that value won’t affect this behavior, if I’m not mistaken. We also don’t have a supported way to do per-app or per-service settings that will then change that timeout. Flycast goes through the Fly Proxy too, so it makes sense as to why you’re seeing the same thing on that hop.

I wanna say it might be worth trying to hit the backend over .internal instead, since that bypasses Fly Proxy. That’d be a good way to see if the proxy is the piece causing the reset here. The HTTP/1.1 behavior is the part I’d still want to dig into a little more. Since this isn’t a normal HTTP close, I wouldn’t necessarily expect a clean FIN, but the client hanging until its own timeout is still something worth confirming separately I think. If you can grab a packet capture from one of the repros, that could help us see what’s happening when the connection gets cut.

I want to correct one thing from my earlier reply here. The ~30s behavior isn’t a separate Fly Proxy “no progress” timeout like I originally described. What we actually have is TCP_USER_TIMEOUT set to 30s. In your case, if the player stops reading long enough, the TCP receive window can drop to zero. If it stays that way long enough, TCP_USER_TIMEOUT can kick in and close the connection.TCP_USER_TIMEOUT also isn’t configurable.

One other thing that stands out is the client behavior after the connection gets cut. If it ends up with no more data and eventually times out, that should really be treated as a failed or interrupted stream instead of a valid empty track. So there could possibly be a client side handling issue as well.

Once again, sorry for the confusion in my first reply, I connected those two behaviors a little too quickly.

Hey, no worries, thanks for responding. To be clear, we do have a workaround, it just took a bit of investigation to get there and I’m not sure if it’s a bug or documentation gap or just how it is. Unfortunately we do have to stay on Flycast because we’re relying on the suspending machines auto-waking, which we’ve gathered doesn’t work with .internal.

As before, here’s Claude with the requested capture, and…prose. Sorry about that, feel free to just read the packet capture part. Thanks again!


Claude:
Thanks for digging into this, and for the follow-up correction. TCP_USER_TIMEOUT explains everything we measured. A paused player lets its receive window fall to zero, the window stays there for 30 seconds, and the connection is closed. That fits both hops. On the Flycast hop the paused reader is our gateway, and on the edge hop it’s the phone.

What we changed on our side

  • Flycast hop. When the gateway’s connection to the backend is cut partway through a file, it now asks the backend for the rest with a Range request and keeps writing to the client. The player never sees the break. On staging, every Flycast-hop cut we caused was picked up this way.
  • The client-handling point. You were right that an empty track was the wrong outcome, but that part was our bug, not the player’s. Our gateway ended the response cleanly after the backend connection was cut, so the player took a short file for a complete one. It now aborts the client connection instead, so the player sees a failed stream.
  • .internal. We’d rather stay on Flycast. We rely on the proxy to start suspended machines, and our backends trust the proxy’s address range for authentication headers. Now that the cause is clear, the Range workaround covers that hop.

Packet capture of the HTTP/1.1 hang

We captured one run on the client, headers only. The client reads 10 MB, stops reading for 60 seconds, then resumes. Times are minutes:seconds from the SYN:

0:05.464506 edge > client: Flags [P.], seq 10637670:10640006, ack 881, win 1024, length 2336
0:05.779515 edge > client: Flags [P.], seq 10640006:10640370, ack 881, win 1024, length 364
0:05.779556 client > edge: Flags [.], ack 10640370, win 0, length 0
0:06.051800 edge > client: Flags [.], ack 881, win 1024, length 0
0:06.051856 client > edge: Flags [.], ack 10640370, win 0, length 0
0:06.563559 edge > client: Flags [.], ack 881, win 1024, length 0
0:06.563615 client > edge: Flags [.], ack 10640370, win 0, length 0
0:07.580821 edge > client: Flags [.], ack 881, win 1024, length 0
0:07.580883 client > edge: Flags [.], ack 10640370, win 0, length 0
0:09.566370 edge > client: Flags [.], ack 881, win 1024, length 0
0:09.566439 client > edge: Flags [.], ack 10640370, win 0, length 0
0:13.467704 edge > client: Flags [.], ack 881, win 1024, length 0
0:13.467783 client > edge: Flags [.], ack 10640370, win 0, length 0
0:21.340818 edge > client: Flags [.], ack 881, win 1024, length 0
0:21.340901 client > edge: Flags [.], ack 10640370, win 0, length 0
1:05.320261 client > edge: Flags [.], ack 10640370, win 7148, length 0
1:05.320368 client > edge: Flags [.], ack 10640370, win 18288, length 0
1:50.368271 client > edge: Flags [F.], seq 881, ack 10640370, win 33799, length 0
1:50.612316 client > edge: Flags [F.], seq 881, ack 10640370, win 33799, length 0
1:50.852758 client > edge: Flags [F.], seq 881, ack 10640370, win 33799, length 0
1:51.332388 client > edge: Flags [F.], seq 881, ack 10640370, win 33799, length 0
1:52.316367 client > edge: Flags [F.], seq 881, ack 10640370, win 33799, length 0
1:54.236866 client > edge: Flags [F.], seq 881, ack 10640370, win 33799, length 0
  • 5.8s: the client stops reading and advertises a zero window.
  • 6.1–21.3s: the edge sends six zero-window probes, backing off each time. The client answers each with win 0.
  • After 21.3s: the edge never sends another packet.
  • 35.5s: our gateway logs Broken pipe on its connection from the edge. So the edge closed its upstream side about 30 seconds after the client’s window closed, which matches TCP_USER_TIMEOUT.
  • 65.3s: the client starts reading again and sends two window updates. No response.
  • 110.4s: the client hits its own 45-second timeout and sends a FIN. It retransmits it five times and gets no response, not even a RST.

So when the timeout fires, the edge closes the connection toward the app, but the client side is dropped silently. Every segment the client sends afterwards is ignored rather than answered with a reset. You mentioned you wouldn’t expect a clean FIN, and we agree. But we’d have expected a RST, either when the edge gives up or in reply to the client’s next segment.

That silence is what hurts here. A player that gets a RST fails at once and can retry. A player that gets nothing waits for its own timeout with the audio stopped. Would it be possible for the edge to send a RST to the client when it aborts a connection this way, or at least to answer later segments on that connection with one?

The full .pcap (headers only, 9,215 packets) is available if it would help. Just let me know where to send it.

Thanks for grabbing the packet capture and apologies for the delayed response on my end!

I’m going to pass this along to our networking team so we can take a closer look at the client-side behavior after TCP_USER_TIMEOUT fires. I’ll follow up here once I have more to share with you. Thank you for your patience in all of this as well, I appreciate it!