Repository navigation
Description
Welcome!
- I have read the Documentation
- I have checked the Common Issues Guide and my problem was not mentioned there.
- I have searched open and closed issues and my problem was not mentioned before.
- I have verified I am using the latest version available. You can check the latest release here.
Component
Agent
Problem Description
After upgrading both the Hub and agents to 0.19.0, some WebSocket agents periodically disconnect and immediately reconnect.
This is much easier to reproduce with the beszel-agent:alpine image. In my environment, the standard 0.19.0 agent does not show this behavior, while two Alpine-based agents running on PVE hosts repeatedly hit it.
Example logs:
WARN Connection closed err="connection closed, code=1000, reason="
WARN Disconnected from hub
INFO WebSocket connected host=beszel.example.com
After checking the source code and collection timestamps in the database, this appears to be caused by a tight timing boundary:
- Hub collection interval: 60 seconds
- WebSocket deadline: 70 seconds
- Normal agents: maximum interval around 60.2 seconds
- Affected PVE / Alpine agents: occasionally around 80 seconds
- When the 70-second deadline is exceeded, the connection expires and the agent reconnects
- During reconnection, the previous connection is closed with WebSocket code
1000
The 70-second deadline therefore leaves only about 10 seconds of tolerance above the normal collection interval.
I also checked the current main branch and the deadline still appears to be 70 seconds.
The Hub is behind nginx with proxy_read_timeout 360s. The disconnects occur well before this timeout, and nginx access logs show new WebSocket connections corresponding exactly to the reconnect events.
The Alpine image may simply make this easier to trigger due to additional or slower metric collection. I have not confirmed that Alpine itself is the root cause; the underlying issue appears to be the narrow margin between the 60-second collection interval and the 70-second deadline.
Expected Behavior
A healthy WebSocket agent should remain connected when a metric collection cycle occasionally takes slightly longer than 70 seconds.
The WebSocket deadline should provide sufficient tolerance above the normal 60-second collection interval.
For example, increasing the deadline from 70 seconds to 120 seconds, or deriving it from the collection interval, would tolerate occasional slow collection cycles while still detecting genuinely stalled connections.
Steps to Reproduce
- Run Beszel Hub
0.19.0. - Run a
0.19.0agent using thebeszel-agent:alpineimage on a host where metric collection can occasionally take longer than 70 seconds (PVE hosts reproduce this in my environment). - Connect the agent to the Hub using WebSocket/WSS.
- Leave the agent running and observe its logs.
- When a collection cycle exceeds approximately 70 seconds, observe:
WARN Connection closed err="connection closed, code=1000, reason="
WARN Disconnected from hub
INFO WebSocket connected host=beszel.example.com
- Compare the collection timestamps in the database. In my environment, unaffected agents stay around ~60 seconds, while the affected agents occasionally reach ~80 seconds.
- The reconnect timestamps also correlate with new WebSocket requests in the nginx access log.
For reference, nginx is configured with:
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 360s;The disconnect therefore occurs well before the reverse proxy timeout.
OS / Architecture
Proxmox VE / Linux x86_64
Beszel version
0.19.0
Installation method
Docker
Activity
onefish2 commentedon Sep 4, 2026
I am seeing the same exact issue with my Proxmox host.
henrygd commentedon Sep 4, 2026
Thanks for the report. Strange that it only affects the Alpine images. I can bump the deadline to 120 seconds or add pings for active connections.
Taking over 70 seconds for collection is veeeeerrrrrrry slooooow. Can you try setting
LOG_LEVEL=debugon the agent to see where all the time is being spent?heroichaiku commentedon Sep 4, 2026
Not sure I can personally add much to help other than that I'm seeing the same behavior using 0.19.0 on a Proxmox server running binary agent and a proxmox LXC with the latest hub.
FWIW this was the complete section of logs from connection to disconnection. Nothing removed. Line breaks added for emphasis of connection specifics.
fix(agent): extend WebSocket deadline for slow collections (henrygd#2297
monotonus commentedon Sep 19, 2026
Still happening on 0.20.0 (hub and agent both updated), on a Proxmox VE host.
2026/09/19 23:11:04 WARN Connection closed err="connection closed, code=1000, reason="
2026/09/19 23:13:12 WARN Connection closed err="connection closed, code=1000, reason="
2026/09/19 23:15:09 WARN Connection closed err="connection closed, code=1000, reason="
15 disconnects per 30 min, same rate as before 0.20.0.
Disabling the websocket on the agent (SSH pull only) gave 2 hours with zero
disconnects, re-enabling it brought the ~2 min cycle straight back. Raising the
reverse proxy timeouts changed nothing. Two other agents on the same hub (a VM
and a small VPS, both much lighter) are unaffected, only the Proxmox host.
Running pull-only as a workaround.
Update henrygd/beszel Docker tag to v0.20.0 (#49)
Update henrygd/beszel-agent Docker tag to v0.20.0 (#15)
Update ghcr.io/henrygd/beszel/beszel Docker tag to v0.20.0 (#14)
sneak-it commentedon Sep 20, 2026
Following up to comment having the same issue as @monotonus , agents and hub on 0.20.0.
christu90 commentedon Sep 23, 2026
Same here, both at 20.0 but with local installed agent on PVE and PBS. On other VM or my Synology all works fine.
fix: prevent WebSocket reconnect loops on slow agent collections (#2294)
henrygd commentedon Sep 23, 2026
Thanks everyone for the reports and logs. @heroichaiku's debug output provided the likely cause. I just pushed a fix.
The 70s deadline wasn't the problem. The hub only waited 5 seconds for stats over WebSocket, and if the agent took longer, the hub closed the connection. That's the
code=1000you were seeing.zpool listcan apparently hang for up to its 10s timeout, and it ran about every other collection, which is why the disconnects came every ~2 minutes. It showed up with the Alpine image because that image includes the ZFS utilities and the default image doesn't.The fix changes both sides:
zpool list/zfs listin the background, so a slow run doesn't hold up collection.It'll be in the next release. Let me know if you still see disconnects after updating.
fix(hub): ping a slow agent so its connection survives between polls
fix(hub): ping a slow agent so its connection survives between polls
fix(hub): raise the read deadline so the keepalive ping can land
Update henrygd/beszel-agent Docker tag to v0.21.0 (#21)
Update ghcr.io/henrygd/beszel/beszel Docker tag to v0.21.0 (#20)
fix(agent): extend WebSocket deadline for slow collections (henrygd#2297