Skip to content

[Bug]: 70s WebSocket deadline causes reconnect loops when collection exceeds 70s #2294

Description

@loinky

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

  1. Run Beszel Hub 0.19.0.
  2. Run a 0.19.0 agent using the beszel-agent:alpine image on a host where metric collection can occasionally take longer than 70 seconds (PVE hosts reproduce this in my environment).
  3. Connect the agent to the Hub using WebSocket/WSS.
  4. Leave the agent running and observe its logs.
  5. 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
  1. Compare the collection timestamps in the database. In my environment, unaffected agents stay around ~60 seconds, while the affected agents occasionally reach ~80 seconds.
  2. 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

Configuration

Hub Logs

Agent Logs

Activity

  1. added
    bug
    on Sep 4, 2026
  2. onefish2 commented on Sep 4, 2026

    @onefish2

    I am seeing the same exact issue with my Proxmox host.

  3. henrygd commented on Sep 4, 2026

    @henrygd
    Owner

    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=debug on the agent to see where all the time is being spent?

  4. heroichaiku commented on Sep 4, 2026

    @heroichaiku

    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.

    Sep 04 23:23:36 mini beszel-agent[4181816]: 2026/09/04 23:23:36 INFO WebSocket connected host=beszel.galaxy.lan
    Sep 04 23:23:36 mini beszel-agent[4181816]: 2026/09/04 23:23:36 DEBUG Cached data cacheTimeMs=60000
    
    Sep 04 23:24:11 mini beszel-agent[4181816]: 2026/09/04 23:24:11 DEBUG Load average 5m=0.31 15m=0.28
    Sep 04 23:24:11 mini beszel-agent[4181816]: 2026/09/04 23:24:11 DEBUG Temperature sensors="[{\"sensorKey\":\"acpitz\",\"temperature\":20,\"sensorHigh\":0,\"sensorCritical\":0} {\"sensorKey\":\"nvme_composite\",\"temperature\":52.85,\"sensorHigh\":74.85,\"sensorCritical\":84.85} {\"sensorKey\":\"nvme_sensor_1\",\"temperature\":53.85,\"sensorHigh\":65261.85,\"sensorCritical\":0} {\"sensorKey\":\"nvme_sensor_2\",\"temperature\":52.85,\"sensorHigh\":65261.85,\"sensorCritical\":0} {\"sensorKey\":\"nvme_sensor_3\",\"temperature\":52.85,\"sensorHigh\":0,\"sensorCritical\":0} {\"sensorKey\":\"k10temp_tctl\",\"temperature\":59.25,\"sensorHigh\":0,\"sensorCritical\":0} {\"sensorKey\":\"amdgpu_edge\",\"temperature\":52,\"sensorHigh\":0,\"sensorCritical\":0}]"
    Sep 04 23:24:11 mini beszel-agent[4181816]: 2026/09/04 23:24:11 DEBUG Extra FS data=map[]
    Sep 04 23:25:11 mini beszel-agent[4181816]: 2026/09/04 23:25:11 DEBUG Load average 5m=0.3 15m=0.28
    Sep 04 23:25:21 mini beszel-agent[4181816]: 2026/09/04 23:25:21 DEBUG ZFS pool stats unavailable err="zpool list: zpool timed out after 10s: context deadline exceeded"
    Sep 04 23:25:21 mini beszel-agent[4181816]: 2026/09/04 23:25:21 DEBUG Temperature sensors="[{\"sensorKey\":\"acpitz\",\"temperature\":20,\"sensorHigh\":0,\"sensorCritical\":0} {\"sensorKey\":\"nvme_composite\",\"temperature\":52.85,\"sensorHigh\":74.85,\"sensorCritical\":84.85} {\"sensorKey\":\"nvme_sensor_1\",\"temperature\":53.85,\"sensorHigh\":65261.85,\"sensorCritical\":0} {\"sensorKey\":\"nvme_sensor_2\",\"temperature\":52.85,\"sensorHigh\":65261.85,\"sensorCritical\":0} {\"sensorKey\":\"nvme_sensor_3\",\"temperature\":52.85,\"sensorHigh\":0,\"sensorCritical\":0} {\"sensorKey\":\"k10temp_tctl\",\"temperature\":60.125,\"sensorHigh\":0,\"sensorCritical\":0} {\"sensorKey\":\"amdgpu_edge\",\"temperature\":51,\"sensorHigh\":0,\"sensorCritical\":0}]"
    Sep 04 23:25:21 mini beszel-agent[4181816]: 2026/09/04 23:25:21 DEBUG Extra FS data=map[]
    
    
    Sep 04 23:25:21 mini beszel-agent[4181816]: 2026/09/04 23:25:21 WARN Connection closed err="connection closed, code=1000, reason="
    Sep 04 23:25:21 mini beszel-agent[4181816]: 2026/09/04 23:25:21 WARN Disconnected from hub
    Sep 04 23:25:21 mini beszel-agent[4181816]: 2026/09/04 23:25:21 INFO WebSocket connected host=beszel.galaxy.lan
    Sep 04 23:25:21 mini beszel-agent[4181816]: 2026/09/04 23:25:21 DEBUG Cached data cacheTimeMs=60000
    

    FWIW this was the complete section of logs from connection to disconnection. Nothing removed. Line breaks added for emphasis of connection specifics.

  5. added a commit that references this issue on Sep 5, 2026
    027d0c2
  6. monotonus commented on Sep 19, 2026

    @monotonus

    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.

  7. sneak-it commented on Sep 20, 2026

    @sneak-it

    Following up to comment having the same issue as @monotonus , agents and hub on 0.20.0.

  8. christu90 commented on Sep 23, 2026

    @christu90

    Same here, both at 20.0 but with local installed agent on PVE and PBS. On other VM or my Synology all works fine.

  9. henrygd commented on Sep 23, 2026

    @henrygd
    Owner

    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=1000 you were seeing. zpool list can 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:

    • Hub: waits up to 30s for stats, and no longer drops the connection when a request is just slow.
    • Agent: refreshes zpool list / zfs list in 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.

  10. added 3 commits that reference this issue on Sep 27, 2026
    7ac8df8
    79521aa
    bb8a4e3
  11. added a commit that references this issue on Oct 17, 2026
    189bc9b
  12. locked and limited conversation to collaborators on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions