paultanay opened a new pull request, #4342:
URL: https://github.com/apache/hertzbeat/pull/4342

   Fixes #4203
   
   **Root cause**
   
   `monitorCollectTaskTimeout()` pre-removed the map entry before calling
   `dispatchCollectData()`. If a naturally finishing `MetricsCollect` arrived
   in that window, it called `dispatchCollectData()` as well, producing a
   duplicate `cyclicJob()` and `sendMetricsData()`.
   
   The Prometheus path in `MetricsCollect.run()` also had no `fastFailed()`
   guard, unlike the standard path.
   
   **Fix**
   
   `dispatchCollectData()` now owns the atomic 
`metricsTimeoutMonitorMap.remove()`
   and acts as the once-wins gate. A duplicate call sees `metricsTime == null`
   and returns immediately.
   
   For priority > 0 timed-out metrics the monitor removes the entry and cancels
   the in-flight collect directly, since no TIMEOUT payload is sent downstream.
   
   `cancel()` fires after `dispatchCollectData()` so the `!isCancelled()` guard
   does not block `cyclicJob()`.
   
   Added `fastFailed()` check before the Prometheus list-dispatch in 
`MetricsCollect`.
   
   **Tests**
   
   New `CommonDispatcherTest`:
   - Priority-0 expired entry: dispatches once, cancels, map empty.
   - Second scan of same entry: no duplicate dispatch.
   - Priority-1 expired entry: cancels without dispatching.
   - Non-expired entry: nothing touched.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to