The GitHub Actions job "Backend CI" on 
hertzbeat.git/fix/collector-timeout-duplicate-dispatch has failed.
Run started by GitHub user paultanay (triggered by paultanay).

Head commit for run:
809203828db70bada1c44dcf969612de973bf780 / paultanay <[email protected]>
[fix] prevent duplicate dispatch when collector task times out after 4 minutes 
(#4203)

When a MetricsCollect task ran longer than the DURATION_TIME (240 s) threshold,
monitorCollectTaskTimeout() would remove the entry from 
metricsTimeoutMonitorMap,
send a TIMEOUT result via dispatchCollectData(), and then cancel the Timeout.
If the real collect finished between the dispatch and the cancel it would call
dispatchCollectData() a second time, causing data duplication and a spurious
re-schedule of the collection cycle.

Fix (CommonDispatcher):
- Cancel the Timeout *before* dispatching the TIMEOUT result. Once the Timeout
  is cancelled, any in-flight MetricsCollect.run() that reaches fastFailed()
  will see isCancelled()==true and return immediately, never calling
  dispatchCollectData() again.
- Extend the cancel() call to all priority levels, not just priority 0. Higher-
  priority metrics also have in-flight collects that must be stopped; only the
  TIMEOUT dispatch payload is still gated on priority==0.

Fix (MetricsCollect):
- Add a fastFailed() guard before the Prometheus list-dispatch path. The 
standard
  single-metric path already returned early on fastFailed(); the Prometheus path
  skipped that check and could still deliver a late result after cancellation.

Test (CommonDispatcherTest):
- New regression test: monitorCollectTaskTimeout() with a priority-0 expired
  entry asserts cancel-before-dispatch ordering and exactly one 
dispatchCollectData
  invocation.
- Second test: priority-1 expired entry asserts cancellation with zero dispatch
  calls, covering the non-availability metrics case.

Report URL: https://github.com/apache/hertzbeat/actions/runs/32580735937

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to