Skip to content

bugfix: prefetch bug#12

Merged
yasyzb merged 4 commits intodevelopfrom
bugfix/prefetcher
Apr 11, 2022
Merged

bugfix: prefetch bug#12
yasyzb merged 4 commits intodevelopfrom
bugfix/prefetcher

Conversation

@yasyzb
Copy link

@yasyzb yasyzb commented Apr 11, 2022

Description

1.Fix panic in trie_prefetcher close
2.Fix trie_prefetcher abortLoop goroutine leak

Rationale

1.In ValidateState, there are three goroutines running concurrently, if the previous one return error, the upper caller function InsertChain would return and call it's defer function to close prefetcher, while the IntermediateRoot goroutine still run and when it done call its defer function to close prefetcher, this time the prefetcher is nil, so it will trigger a panic. So we should wait all the goroutines done in ValidateState to avoid this panic.
2.In InsertChain, if we enable diffsync, and insert two more blocks here, then all the blocks except the last one wound't do call StopPrefetcher, so these blocks' abortLoop goroutine will leak. So we should do the StopPrefetcher in IntermediateRoot to avoid this leak.

@yasyzb yasyzb merged commit c9d6125 into develop Apr 11, 2022
@yasyzb yasyzb deleted the bugfix/prefetcher branch April 11, 2022 04:53
@yasyzb yasyzb changed the title fix prefetch bug bugfix: prefetch bug Apr 11, 2022
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.

1 participant

Comments