#3365

Torrent list polls every 3 s when no sync changes anything for 2 minutes

Opens0up4200opened 9d ago

Part of #3342. This happens only with #3349, which is not merged yet.

Problem

When no sync changes anything for 2 minutes, the open torrent list stops using the stream and polls qui every 3 seconds. A cross-instance view polls every 10 seconds. Each poll reads the qui cache, not qBittorrent, but qui builds the whole view again for each poll. On a large library, that is the work that #3001 removes from each sync.

Cause

  • #3349 pins go-qbittorrent ecff3f2464a3. That version calls OnUpdate only for a sync response that changed the data (sync.go:51). If nothing changed, qui sends only heartbeats and no update or delta frame.
  • The client resets its data deadline only when a data frame arrives, not on a heartbeat. The deadline is STREAM_DATA_STALE_TIMEOUT_MS (120 s) in web/src/contexts/SyncStreamContext.tsx.
  • After 120 s, the client marks the stream as stalled (dataStalled). useTorrentsList then polls at TORRENT_STREAM_POLL_INTERVAL_MS (3 s), or every 10 s for a cross-instance view.

On develop this does not happen, because each sync sends a delta, also when the delta is empty.

#3362 makes the trigger less frequent. A sync that changes only the server state (speeds, free disk space) sends a frame again. A quiet instance can still change nothing, for example when all torrents are stopped, nothing transfers, and DHT is off.

History

  • #2508 added the 2-minute rule. Before it, one view could stop getting data while the heartbeats of the shared connection continued. The view then looked live and showed old rows, speeds, and Dashboard numbers. #2508 marks a view as stalled after 2 minutes with no data frame and moves only that view to polling.
  • The rule expects a healthy view to get a data frame at least every 2 minutes. That is true on develop, which sends a delta on each sync. #3349 removes the empty deltas, so a quiet view now looks stalled.
  • The poll intervals are older than #2508. #551 added the 3-second interval, and #1481 added the 10-second interval for the cross-instance table. #2508 reuses them.

Trigger

  1. Use qBittorrent 5.2 or later with #3349.
  2. Stop all torrents and turn off DHT.
  3. Keep the torrent list open for more than 2 minutes.

In the #3362 field test (50,000 torrents, DHT off), the idle window of 120 s sent heartbeats only. I found the polling part in the client code and did not see it in a browser.

Possible fixes

  • Server: send an empty delta when a view sent no data frame for some time, for example 60 s.
  • Client: reset the data deadline on a heartbeat when the server says that the sync of the instance is healthy.

Activity

0

No activity yet.