Skip to content

perf: release RLock before blocking select in deliver#33446

Closed
hawkadrian wants to merge 1 commit intoethereum:masterfrom
hawkadrian:fix/optimize-deliver-lock
Closed

perf: release RLock before blocking select in deliver#33446
hawkadrian wants to merge 1 commit intoethereum:masterfrom
hawkadrian:fix/optimize-deliver-lock

Conversation

@hawkadrian
Copy link
Copy Markdown

What

Release RLock() before the blocking select in deliver(). Copy postC to a local variable under the lock, then release it before channel operations. Add recover() to handle the race where the channel may be closed between copying and using it.

Why

Prevents closewait() from blocking when waiting for Lock() while deliver() holds RLock() during channel operations. This improves responsiveness when closing subscriptions under high concurrency.

@hawkadrian hawkadrian requested a review from fjl as a code owner December 18, 2025 12:50
@gballet
Copy link
Copy Markdown
Member

gballet commented Mar 13, 2026

Thanks for your contribution. The default behavior works fine, and calling recover is an anti-pattern. We will be closing this.

@gballet gballet closed this Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants