debug_traceCallMany: extend timeout CTS lifetime to enumerator disposal#11429
Conversation
Bind the timeout CancellationTokenSource lifetime to enumerator disposal in DebugRpcModule.TraceCallMany's simple path. The previous `using` scope disposed the CTS before the lazy bundle pipeline was enumerated, leaving the cancellation token unusable to downstream consumers (e.g. WaitHandle throws ObjectDisposedException). Mirrors the iterator-owns-CTS pattern already used by EthRpcModule.GetLogs. Streaming is preserved -- no per-bundle or per-trace buffering is introduced. Add two regression tests covering the disposed-CTS bug and guarding against a future eager-materialization regression. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude finished @LukaszRozmej's task in 3m 49s —— View job Review:
|
Collapse the two regression tests into one that exercises both invariants: the first inner sequence touches WaitHandle (catches premature CTS disposal), the second bundle throws unconditionally (catches eager materialization). Drops the local-mock factory and revertes the CreateDebugRpcModule overload -- shared mocks already configured for similar tests in this fixture work fine here. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirror EthRpcModule.eth_getFilterLogs: dispose the timeout CTS in a catch block if anything between creation and handoff to StreamBundleTraces throws. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@claude re-review |
|
Claude finished @LukaszRozmej's task in 2m 6s —— View job Re-review:
|
Replaces #11425
Changes
CancellationTokenSourcelifetime to enumerator disposal inDebugRpcModule.TraceCallMany's simple path. The previoususingscope disposed the CTS before the lazy bundle pipeline was enumerated, leaving the cancellation token unusable to downstream consumers (e.g.WaitHandleaccess throwsObjectDisposedException).EthRpcModule.GetLogs. Streaming is preserved — no per-bundle or per-trace buffering is introduced.Debug_traceCallMany_does_not_dispose_timeout_cts_before_consumer_enumeratesfails on the unfixed code withObjectDisposedExceptionand passes with the fix.Debug_traceCallMany_does_not_eagerly_materialize_bundlesguards against a regression to eager materialization.Replaces #11425, which fixed the same bug by materializing every bundle/trace into nested
List<>/T[]and giving up the zero-allocation streaming pipeline that was a deliberate design choice (see #11425 (comment)).Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
DebugModuleTestspass with the fix.ObjectDisposedExceptionfromWaitHandle) and passes with it.Documentation
Requires documentation update
Requires explanation in Release Notes