Add dropaware Sender new type #13242
Labels
A-rpc
Related to the RPC implementation
C-enhancement
New feature or request
D-good-first-issue
Nice and easy! A great choice to get started
Describe the feature
the way the rpc cache works is a single loop over actions:
reth/crates/rpc/rpc-eth-types/src/cache/mod.rs
Line 345 in 3af2afe
disk lookups also reuse that single channel and send actions back to that sender:
reth/crates/rpc/rpc-eth-types/src/cache/mod.rs
Line 360 in 3af2afe
in the meantime the oneshot response senders wait for that action:
reth/crates/rpc/rpc-eth-types/src/cache/mod.rs
Lines 222 to 225 in 3af2afe
these response channels remain in the lru until the action arrives in the mainloop.
This is problematic if the spawned task panics because then nothing is emitted back to the mainloop.
for example if this operation panics
reth/crates/rpc/rpc-eth-types/src/cache/mod.rs
Lines 365 to 372 in 3af2afe
no action is generated by that task.
we can solve this by introducing a drop aware sender wrapper that sends an action on drop, if not consumed:
like:
reth/crates/rpc/rpc-eth-types/src/cache/mod.rs
Lines 373 to 376 in 3af2afe
Additional context
No response
The text was updated successfully, but these errors were encountered: