reth icon indicating copy to clipboard operation
reth copied to clipboard

`insert_block` can be blocking for sometime if many blocks buffered

Open mattsse opened this issue 2 years ago • 0 comments

Describe the feature

on insert_block, we can end up connecting all buffered blocks:

if we add to a side chain:

https://github.com/paradigmxyz/reth/blob/f25fcca33ec2fa90fac79771d8d94529bcbb38c2/crates/blockchain-tree/src/blockchain_tree.rs#L509-L510

this will execute all blocks and can take a while depending on how large side chain is.

since this is a blocking operation, this can cause lead to reth being unresponsive for a bit since CL messages are not handled.

I only observed this in debug mode where execution is considerably slower, so catching up 2 epochs takes quite some time.

the blocking operation try_connect_buffered will eventually finish, and continue operating as normal, and I think this is only an issue in debug mode.

however we should consider restricting how many blocks we connect in one go.

Additional context

No response

mattsse avatar Jun 15 '23 17:06 mattsse