Duansg commented on PR #4196:
URL: https://github.com/apache/hertzbeat/pull/4196#issuecomment-5015445431

   @tomsun28 But I think we should adjust our approach here, rather than simply 
removing this validation. 
   
   For example:
   
   1. The worker thread and the timeout monitor thread compete for exclusive 
access via CAS, ensuring that the result is distributed only once; the losing 
party silently backs off.
   
   2. Adjust scheduling priority and interrupt the running worker thread. Note: 
In the default virtual thread pool, blocking socket I/O is interruptible (JEP 
444), so stuck HTTP/JDBC/Redis read operations will be physically released at 
the timeout, rather than causing a resource leak.
   
   3. The work thread must be mutually exclusive with the timeout monitoring 
thread to ensure that late interrupts never affect threads that have already 
switched to processing other tasks;
   
   4. A mechanism for rolling back after consecutive timeouts (for example, 
skipping N rounds for a metric after M consecutive timeouts) will further 
reduce the number of repeated 4-minute waits caused by a single persistently 
suspended metric;
   
   > Under this logic, in an extreme scenario, the worst-case scenario would be:
   
   → p0 Success
   → p1 Start (Response Blocked) ── 4 min ──→ Fallback: Discard p1, resend 
TIMEOUT, start p2
   → p2 (response blocked) ── 4 min ──→ Discard p2, resend TIMEOUT, start p3
   → p3 (response blocked)     ── 4 min ──→ Discard p3, resend TIMEOUT, start p4
   → p4 (response blocked) ── 4 min ──→ Discard p4, resend TIMEOUT, end this 
round → cyclicJob → Start over from the beginning in the next round
   
   Proceed sequentially, advancing one layer every 4 minutes; at any given 
time, only one layer is active, provided that p0 succeeds. If p0 fails first, 
maintain the existing design—the top layer will short-circuit—and simply 
proceed to the next round.
   
   To summarize, the design goals are as follows: The fallback thread can 
advance the state machine without relying on the response status of a 
deadlocked task. Interrupts are used to free up resources as much as possible, 
while fallback dispatch ensures bounded recovery.


-- 
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