Skip to content
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

fix: eth fetcher re-queue issue #1302

Merged
merged 1 commit into from
Feb 8, 2023

Conversation

galaio
Copy link
Contributor

@galaio galaio commented Feb 7, 2023

Description

Some node report sync sucks, node logs as below:

t=2023-02-01T07:44:23+0000 lvl=info msg="Imported new chain segment" blocks=1 txs=138 mgas=18.556 elapsed=2.235s mgasps=8.302 number=25,284,893 hash=0x3b08654acd530ea6d793610218f81d9614d3b31b8eeffe7b372fc809ce15fc09 dirty="226.27 MiB" 
t=2023-02-01T07:44:23+0000 lvl=info msg="Chain reorg detected" number=25,284,892 hash=0x331cb0211dab8c564d87583bcf540ba4030b6b69c4e7d6887252b319ed940914 drop=1 dropfrom=0x3b08654acd530ea6d793610218f81d9614d3b31b8eeffe7b372fc809ce15fc09 add=1 addfrom=0xc91bb810c5aca2c562d36335835673f119b2cdf7404ad18e1b1ff223b9ceada2 
t=2023-02-01T07:44:23+0000 lvl=info msg="Imported new chain segment" blocks=1 txs=123 mgas=20.816 elapsed=226.522ms mgasps=91.893 number=25,284,893 hash=0xc91bb810c5aca2c562d36335835673f119b2cdf7404ad18e1b1ff223b9ceada2 dirty="226.34 MiB" 
t=2023-02-01T07:44:23+0000 lvl=info msg="Re-queue blocks" number=25,284,894 hash=0x3247b6f9fdacd178233a3f77dd7402789983590920974110e70b1dfb12e9b16a 
t=2023-02-01T07:44:34+0000 lvl=info msg="Deep froze chain segment" blocks=16 elapsed=42.439ms number=25,194,893 hash=0xeee1826735b032aea70f6387074c59aeae42c9fec404738fae02666747933371 
t=2023-02-01T07:45:19+0000 lvl=info msg="Downloader queue stats" receiptTasks=0 blockTasks=0 itemSize="26.32 KiB" throttle=8192

In the eth/fetcher main loop, it pops block order by block number, when a poped block height = chainHeight+1, fetcher will insert it into the chain.

Let's think about this situation:

If two continuous blocks arrived, the chain height = the first block height, the first block causes a chain reorg, next block could insert concurrently, but got a Re-queue block alert, and try re-queue. Because the queued state had recorded it before, the re-queue action failed.

Rationale

The PR opt re-queue logic, force block enqueue and wait for the next pop.

Changes

Notable changes:

  • fix the re-queue failed bug;

@brilliant-lx brilliant-lx merged commit e4575c5 into bnb-chain:develop Feb 8, 2023
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.

3 participants