-
Notifications
You must be signed in to change notification settings - Fork 20.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A potential dead lock of client which result in block syncing halt #22131
Comments
I still don't get it, if the subscription is uninstalled sucessfully, no more following events will be sent to this filter. |
And regarding the deadlock. Before uninstall request get processed, all the queued events can be processed by the Unsubscribe function too, so I don't think the eventLoop will be blocked. Maybe I miss something here? |
@guagualvcha did you also send this as a bounty? I tried the repro earlier, and was never able to repro it. I'll give it another go later |
@s1na will try to reproduce the issue |
Hi, teams. Thanks for all the timely responses. @s1na @holiman To easily reproduce the issue, you will need 1. the block chain should have some new transactions, empty block can not reproduce the issue. 2. change the code a bit, in the above case, I did sleep 3 seconds when |
I could reproduce the issue (thanks for the pointers).
@rjl493456442 I think the problem is when there are multiple filters. Filter I'm now going to think about a fix. |
Yeah, I get it. Multiple filters explain the reason! |
…22178) This fixes ethereum#22131 and adds a test reproducing the issue.
System information
Geth version: 1.9.13
OS & Version: Linux
Expected behaviour
Client sync block normal
Actual behaviour
Client failed to sync block.
Steps to reproduce the behaviour
First change the code to make it easier to reproduce:
Do request for multi times:
Backtrace
Here is the pprof of go routine:
goroutine.txt
According to the pprof, the code is blocked on
/server/bsc/event/feed.go:170
.select
.As we checked, new
NewPendingTransactionFilter
calls are pending on fetchingfiltersMu
lock.filtersMu
lock istimeoutLoop
:The code is:
Obvious it failed to do
sub.es.uninstall <- sub.f
.eventLoop
is responsible for consuming thesub.es.uninstall
channel.The routine is busy doing
handleTxsEvent
:It will push
hashes
tof.hashes
channel, and now it is blocking by that channel.f.hashes
channel?That is because, in the above step 3, the
Unsubscribe
may not consume all thehashes
and break out so that step4 stucked.The deadlock dependency is:
Routine A:
NewPendingTransactionFilter
want to lockfiltersMu
to consumehashes
;Routine B:
eventLoop
is waiting Routine A to consumehashes
so that it can push new hash to channel.Routine C:
Unsubscribe
is holding lockfiltersMu
, but it is waiting for Routine B to consumeuninstall
channel.The text was updated successfully, but these errors were encountered: