🐛 Long lived websocket seems to disconnect consistently
Describe the bug and To Reproduce A service is being exposed via a cloudflared tunnel (http endpoint). Clients connect to the service via the exposed tunnel which then upgrades the connection to a websocket. The clients consistently disconnect - and a successful reconnect happens since our clients can reconnect.
Expected behavior This only happens when the client connects via the tunnel, if no tunnel is being used the disconnect behavior does not happen.
Environment and versions
- OS: Service: Linux and Macos
- Architecture: arm64
- Version: cloudflared version 2024.6.0 (built 2024-06-03T18:29:11Z)
Logs and errors
When the socket disconnects we do get this output: Read error: websocket: close 1006 (abnormal closure): unexpected EOF
This is actually not a bug, rather a limitation of the current production websocket impl, you can contact support and ask them to enable the Websocket handoff feature which can increase the lifetime of a websocket connection by an order of magnitude. the drawback of this is lesser visibility (you are unable to view total bandwidth of websockets in the zone)
Is this the reason? Any plans this will change? (soon ?)
Unless its something on my end sometimes its reconnecting every other minute which kinda makes it hard to make it unnoticed
I don't work at cf and can't comment about any plans that may or may not exist but you can ask support to enable websocket handover
Is this the reason? Any plans this will change? (soon ?)
Unless its something on my end sometimes its reconnecting every other minute which kinda makes it hard to make it unnoticed
every other minute is quite often, Id think there is something else going on, possibly config somewhere. consider asking support or posting in discord/forums
Its mostly fine but yes some days theres very "hot" 10 minutes of reconnects. Also find it hard to believe this is expected but only does it through the tunnel and at specific times of the day so
I think we're facing this problem as well.
We have the same issue, started after switching to Cloudflare websocket / tunnel.
This is actually not a bug, rather a limitation of the current production websocket impl, you can contact support and ask them to enable the Websocket handoff feature which can increase the lifetime of a websocket connection by an order of magnitude. the drawback of this is lesser visibility (you are unable to view total bandwidth of websockets in the zone)
We reached out to CF support about this, and activating the feature made no difference.
Also increased idle timeout duration on tunnel web settings, but no difference.
Unfortunatly, we'll not use it until Cloudflare provides a solution.