You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Each RethrowExceptions() call makes the stored exception's StackTrace longer: after 1,000 calls it is 2,009 lines (~280 KB) #105
When an action fails, the failure is stored once, on PollingTask or ActionTask. After that, every RethrowExceptions() call rethrows the same exception object with ExceptionDispatchInfo.Capture(exception).Throw() (IntervalAction/IntervalAction.cs:825; TryRun does the same at line 585).
Capture snapshots the exception's current trace, and that trace already includes every earlier rethrow. Each call therefore adds another --- End of stack trace from previous location --- section and a RethrowExceptions frame. The exception object is the same every time, so the trace keeps growing.
This is a side effect of the fix for #58 (PR #62), which added the EDI rethrow to keep the action's frames.
usingktsu.IntervalAction;Exception?last=null;varia=IntervalAction.Start(new(){Action=()=>thrownewInvalidOperationException("boom"),PollingInterval=TimeSpan.FromMilliseconds(10),ActionInterval=TimeSpan.FromSeconds(10)});awaitTask.Delay(300);for(inti=1;i<=1000;i++){try{ia.RethrowExceptions();}catch(Exceptione){if(iis1 or 2 or 10 or 1000)Console.WriteLine($"call {i}: same={ReferenceEquals(e,last??e)} len={e.StackTrace?.Length} lines={e.StackTrace?.Split('\n').Length}");last=e;}}
Expected: the trace is the same length on every call.
Why it matters
Calling RethrowExceptions() periodically, from a health check, watchdog or UI tick, is how a caller finds out the action failed. Once it has failed, each poll adds about 280 bytes to a string the instance keeps alive, and each call costs more than the last.
At one check per second, a day is about 86,400 calls. That makes a trace of roughly 24 MB, and every logged copy of it repeats the same frames tens of thousands of times.
Suggested fix
Capture one ExceptionDispatchInfo when the failure is first observed, store it, and call .Throw() on that stored instance each time.
Clear the stored instance wherever the failure is cleared today (the restart path).
Make the same change in TryRun (line 585) if it can rethrow the same failure more than once.
Acceptance criteria
A test calls RethrowExceptions() N times (say 100) after a failure.
It asserts that StackTrace is the same length on every call.
Priority: High. Polling RethrowExceptions() from a health check or watchdog after a failure is the documented way to find out the action failed. Each poll grows a string the instance keeps alive without limit: roughly 24 MB a day at one check per second, and every call costs more than the one before.
Area / suggested assignment:IntervalAction/IntervalAction.cs, at the RethrowExceptions rethrow (line 825) and the TryRun rethrow (line 585). Store one ExceptionDispatchInfo when the failure is first captured, and clear it on the restart path.
Activity
matt-edmondson commentedon Nov 9, 2026
Triage
RethrowExceptions()from a health check or watchdog after a failure is the documented way to find out the action failed. Each poll grows a string the instance keeps alive without limit: roughly 24 MB a day at one check per second, and every call costs more than the one before.IntervalAction/IntervalAction.cs, at theRethrowExceptionsrethrow (line 825) and theTryRunrethrow (line 585). Store oneExceptionDispatchInfowhen the failure is first captured, and clear it on the restart path.Restart()discarding an unobserved exception, touches the same restart and clear path. Fix them together, or at least make sure the stored EDI is cleared in exactly the place Restart() silently discards an action exception the polling loop hasn't observed yet, so RethrowExceptions() reports nothing #75 settles on.Generated by Claude Code