🐛ERR Connection terminated error="connection with edge closed" connIndex=0 2025-04-03 20:18:13 2025-04-04T00:18:13Z ERR Connection terminated error="Error shutting down control stream: client disconnected" connIndex=3
Describe the bug My Docker instance of Cloudflared will run for about 1-6hrs max, most of the time less than 6hrs. Without any external input, no changes in network, nothing, the tunnel will shutdown, it closes connection with edge and shuts down. I know Im not the only one having this issue because a couple of quick google searches showed that this is a consistent problem for multiple users. There is nothing in my logs that suggest abnormal behavior. No indications of intrusion, DDos, or errors with my server. Everything runs perfectly fine until cloudflared decides to close connection with edge. This is a major problem, why its been happening since March 16 2023 Old Issue and still isn't fixed is absolutely baffling.
To Reproduce Steps to reproduce the behavior:
- Configure: Run docker container as usual
- Run: Runs for about 6hrs then closes connection with edge prompting a restart.
- See error: Always the same error no matter how many settings I change.
If it's an issue with Cloudflare Tunnel: 4. Tunnel ID : 96f03c3c-cb70-4da8-a49f-98baacbcb2f2 5. cloudflared config: Standard config with a --network tunnel --protocol http2
Expected behavior Tunnel should stay connected to origin and Cloud Flare without needing to restart everyday.
Environment and versions
- OS: MacOS Docker Desktop
- Architecture: ARM
- Version: latest
Logs and errors If applicable, add logs or errors to help explain your problem.
'ERR Connection terminated error="connection with edge closed" connIndex=2 2025-04-03 20:18:13 2025-04-04T00:18:13Z ERR Connection terminated error="connection with edge closed" connIndex=0 2025-04-03 20:18:13 2025-04-04T00:18:13Z ERR Connection terminated error="Error shutting down control stream: client disconnected" connIndex=3 2025-04-03 20:18:14 2025-04-04T00:18:14Z ERR Connection terminated error="connection with edge closed" connIndex=1'
Additional context My server runs in a docker container in the same network as my tunnel.
I also have the same problem: ERR failed to serve incoming request error="Error shutting down control stream: context canceled"
Hello, we seems getting this issue as well, intermittently getting "Lost connection with the edge"
2025-06-04T11:11:29Z WRN Connection terminated error="connection with edge closed" connIndex=0 2025-06-04T11:11:28Z INF Unregistered tunnel connection connIndex=0 event=0 ip= 2025-06-04T11:11:28Z INF Retrying connection in up to 1s connIndex=0 event=0 ip= 2025-06-04T11:11:28Z WRN Serve tunnel error error="connection with edge closed" connIndex=0 event=0 ip= 2025-06-04T11:11:28Z INF Lost connection with the edge connIndex=0
do you all receive 523-origin is unreachable error when trying to access during the lost connection with edge ?
It's already 2025, why is there still this problem. There will be this issue when using the http2 protocol, and changing it to quic will result in another error HTTP2 error:
[90m2025-06-06T01:55:28Z[0m [31mWRN[0m Serve tunnel error [31merror=[0m[31m"connection with edge closed"[0m [36mconnIndex=[0m1 [36mevent=[0m0 [36mip=[0m198.41.192.47 2025-06-06 09:55:28 [90m2025-06-06T01:55:28Z[0m [32mINF[0m Lost connection with the edge [36mconnIndex=[0m1 2025-06-06 09:55:26 [90m2025-06-06T01:55:26Z[0m [31mWRN[0m Connection terminated [31merror=[0m[31m"connection with edge closed"[0m [36mconnIndex=[0m3 2025-06-06 09:55:25 [90m2025-06-06T01:55:25Z[0m [32mINF[0m Retrying connection in up to 1s [36mconnIndex=[0m3 [36mevent=[0m0 [36mip=[0m198.41.192.107 2025-06-06 09:55:25 [90m2025-06-06T01:55:25Z[0m [1m[31mERR[0m[0m failed to serve incoming request [31merror=[0m[31m"Error shutting down control stream: context canceled"[0m 2025-06-06 09:55:25 [90m2025-06-06T01:55:25Z[0m [31mWRN[0m Serve tunnel error [31merror=[0m[31m"connection with edge closed"[0m [36mconnIndex=[0m3 [36mevent=[0m0 [36mip=[0m198.41.192.107 2025-06-06 09:55:25 [90m2025-06-06T01:55:25Z[0m [32mINF[0m Lost connection with the edge
QUIC error: Failed to dial a quic connection [31merror= [0m [31m"failed to dial to edge with quic: timeout: no recent network activity" [0m [36mconnIndex= [0m0 [36mevent= [0m0 [36mip= [0m198.41.192.167
I looked at the source code and everything seemed fine. I even ran it through an AI Agent and it couldn't detect anything wrong. Program compiles fine. I think it is an issue with the cloud flare api that handles connections to them in the backend. I also noticed you have to have an extremely stable internet connection. Any loss of power, slight hiccup in your connection, or a change in your server files will cause the connection to quit.
Same here:
Log
Jun 21 12:22:47: 2025-06-21T10:22:47Z INF Lost connection with the edge connIndex=1
Jun 21 12:22:47: 2025-06-21T10:22:47Z WRN Serve tunnel error error="connection with edge closed" connIndex=1 event=0 ip=198.41.200.23
Jun 21 12:22:47: 2025-06-21T10:22:47Z INF Retrying connection in up to 1s connIndex=1 event=0 ip=198.41.200.23
Jun 21 12:22:47: 2025-06-21T10:22:47Z ERR failed to serve incoming request error="Error shutting down control stream: client disconnected"
Jun 21 12:22:49: 2025-06-21T10:22:49Z WRN Connection terminated error="connection with edge closed" connIndex=1
Jun 21 12:22:49: 2025-06-21T10:22:49Z INF Registered tunnel connection connIndex=1 connection=9c6865b8-4e5d-4974-aeb8-1a4b451c8bdb event=0 ip=198.41.200.23 location=mad03 protocol=http2
Jun 21 12:22:50: 2025-06-21T10:22:50Z INF Lost connection with the edge connIndex=0
Jun 21 12:22:50: 2025-06-21T10:22:50Z WRN Serve tunnel error error="connection with edge closed" connIndex=0 event=0 ip=198.41.192.37
Jun 21 12:22:50: 2025-06-21T10:22:50Z INF Retrying connection in up to 1s connIndex=0 event=0 ip=198.41.192.37
Jun 21 12:22:50: 2025-06-21T10:22:50Z INF Lost connection with the edge connIndex=3
Jun 21 12:22:50: 2025-06-21T10:22:50Z WRN Serve tunnel error error="connection with edge closed" connIndex=3 event=0 ip=198.41.200.73
Jun 21 12:22:50: 2025-06-21T10:22:50Z INF Retrying connection in up to 1s connIndex=3 event=0 ip=198.41.200.73
Jun 21 12:22:50: 2025-06-21T10:22:50Z ERR failed to serve incoming request error="Error shutting down control stream: context canceled"
Jun 21 12:22:50: 2025-06-21T10:22:50Z ERR failed to serve incoming request error="Error shutting down control stream: context canceled"
Jun 21 12:22:50: 2025-06-21T10:22:50Z INF Lost connection with the edge connIndex=2
Jun 21 12:22:50: 2025-06-21T10:22:50Z WRN Serve tunnel error error="connection with edge closed" connIndex=2 event=0 ip=198.41.192.167
Jun 21 12:22:50: 2025-06-21T10:22:50Z INF Retrying connection in up to 1s connIndex=2 event=0 ip=198.41.192.167
Jun 21 12:22:50: 2025-06-21T10:22:50Z ERR failed to serve incoming request error="Error shutting down control stream: context canceled"
Jun 21 12:22:51: 2025-06-21T10:22:51Z WRN Connection terminated error="connection with edge closed" connIndex=2
Jun 21 12:22:51: 2025-06-21T10:22:51Z WRN Connection terminated error="connection with edge closed" connIndex=0
Jun 21 12:22:52: 2025-06-21T10:22:52Z WRN Connection terminated error="connection with edge closed" connIndex=3
We are using HTTP/2 because it solved similar issues in some comments around the internet, but we were using auto before and we had the same problems. A week ago these problems did not happen.
We absolutely have downtime during these errors.
tunnelID=4c8d9d22-aeb8-413f-9b16-0083d25fcdf7
We've been getting spikes of 524s that made tunnels unusable, total of 9 cloudflared instances, 4gb ram each, 4cpu. average around 100 requests per second each, well within the supposed limits.
happens with quic and http2 doesn't change anything. it seems like the tunnel doesn't respect keep alive responses properly and keeps hold of dead backend connections
Cloudflare seems to have bigger fish to fry because they just plain don't care about our issues.
@jcsf sorry to ping, but is there some acknowledgement of this issue? Seems there are multiple issues in the repo pointing to the same problem.
I can provide this Ray ID: 96318ef3e819e08b or 96319cd10e51ec91. In between those, the tunnel worked.
My tunnel ID is in my comment above.
Sometimes we get 502 error, sometimes 1003, etc. But in the logs, it's always a disconnection from cloudflared to the edge server.
We don't pay for CF, but I can't imagine this happens only for free tier customers. I've been leaving it for some time in case a solution appeared, but right now I think my only alternative is to migrate off of Tunnels.