Aias00 opened a new issue, #8022:
URL: https://github.com/apache/shenyu/issues/8022

   ### Is there an existing issue for this?
   
   - [x] I have searched the existing issues.
   
   ### Current Behavior
   
   DiagnosticBundleService calculates a total deadline and checks it before 
each section, but then creates DiagnosticBudget with the full sectionTimeoutMs 
and waits on Future.get(sectionTimeoutMs). A section started just before 
total-budget expiry can therefore consume another complete section timeout. The 
remaining total time is never used to cap that wait. Manifest identity 
lookup/archive assembly are also outside this wait boundary, so the contract 
should state precisely what the total timeout covers.
   
   Suggested severity: Medium: the advertised collection deadline is not 
enforced when the remaining total budget is shorter than a section timeout.
   
   ### Expected Behavior
   
   Each collector's execution budget and wait must be bounded by min(section 
timeout, remaining total collection time). When the total budget expires, 
cancel active work and report the remaining sections honestly. Do not promise a 
hard end-to-end deadline if manifest assembly or non-interruptible operations 
remain outside it.
   
   ### Steps To Reproduce
   
   1. Construct DiagnosticBundleService with a blocking collector, 
totalTimeoutMs=50 and sectionTimeoutMs=2000.
   2. Start collect() while the collector remains blocked.
   3. Current code can wait close to 2000 ms for that section even though total 
collection budget is 50 ms.
   4. Also use a fast first collector and a slow second collector to exercise a 
small remaining budget.
   
   Proposed test scenario only; no timing test was executed in the reporting 
environment.
   
   ### Environment
   
   - ShenYu: master / 2.7.2-SNAPSHOT, commit 
`34f2ed036747936a5e28aea2c94cd9b3cddcce47`.
   - Evidence: source inspection. The reporting environment has no available 
Java runtime, so no Maven/JUnit execution or live reproduction is claimed.
   - These issues concern existing runtime behavior, not the proposed plugin 
DAG implementation.
   
   ### Debug logs
   
   No runtime logs captured; this report is based on the source paths below.
   
   ### Code evidence
   
   - [Total deadline and uncapped section 
Future.get](https://github.com/apache/shenyu/blob/34f2ed036747936a5e28aea2c94cd9b3cddcce47/shenyu-web/src/main/java/org/apache/shenyu/web/diagnostics/DiagnosticBundleService.java#L105-L145)
   - [Per-section cooperative 
budget](https://github.com/apache/shenyu/blob/34f2ed036747936a5e28aea2c94cd9b3cddcce47/shenyu-web/src/main/java/org/apache/shenyu/web/diagnostics/DiagnosticBudget.java)
   - [Separately configurable section and total 
timeouts](https://github.com/apache/shenyu/blob/34f2ed036747936a5e28aea2c94cd9b3cddcce47/shenyu-web/src/main/java/org/apache/shenyu/web/diagnostics/DiagnosticProperties.java)
   - [Existing tests cover zero total budget and individual timeouts, not 
remaining-total 
enforcement](https://github.com/apache/shenyu/blob/34f2ed036747936a5e28aea2c94cd9b3cddcce47/shenyu-web/src/test/java/org/apache/shenyu/web/diagnostics/DiagnosticBundleServiceTest.java)
   
   ### Suggested fix direction
   
   Compute the remaining monotonic deadline before submission/wait, cap the 
effective section budget and wait with it, and avoid rounding a positive 
sub-millisecond remainder into an unintended unlimited wait. Preserve 
cancellation, interruption and partial-result behavior. Document the boundary 
of totalTimeoutMs.
   
   ### Acceptance criteria
   
   - A total budget shorter than sectionTimeoutMs bounds collection with a 
reasonable scheduling tolerance.
   - Multiple collectors cannot restart the full section allowance after most 
total budget is spent.
   - Exhausted sections receive appropriate timeout/skipped status and active 
work is cancelled.
   - Existing exception isolation, zero budget and concurrent-job limits remain 
correct.
   
   ### Related work
   
   Diagnostic bundle feature #7936 / #7961. Independent of graph execution.
   


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

Reply via email to