-
Notifications
You must be signed in to change notification settings - Fork 282
Zktrie may lead to a race condition and crash geth when preimage is enabled #177
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Several days ago, I found this function doesn't use the RWLock (https://github.com/scroll-tech/go-ethereum/blob/staging/trie/database.go#L365-L376). Wonder if this place is helpful for this issue. |
Many thanks for your discovery. It is the caller's responsibility to lock the db outside of this function. (So we lock the db when calling it). I think the issue is infact caused by |
You are right Bro. In geth, they extracted this part into a new function with a RWMutex lock (https://github.com/ethereum/go-ethereum/blob/master/trie/preimages.go#L73-L87). |
Looking into the stacks and we found the issue should be cause by prefetching. By disabling it, the node can sync smoothly, under ~10mgasps, or ~100tps, everything works well and app can exit and restart normally. The memory usage is kept under 2GB I am afraid we do not handle prefetch for skip any actions in trie's Currently, prefetch can be disabled by |
System information
Geth version:
pre-alpha 2.2
OS & Version: Linux/OSX
Expected behaviour
Run l2geth with
--gcmode=archive
, which enforce preimage being enabled and start syncing tomain
network. App would crash while syncing at random time.Actual behaviour
No crashing and successfully syncing
Steps to reproduce the behaviour
Following the instruction in running your own l2geth node, then wait for syncing finishing
Also notice that some 'addLeaf:GetNode err key not found in ZkTrieImpl' debug messages are being printed.
Backtrace
When submitting logs: please submit them as text and not screenshots.
The text was updated successfully, but these errors were encountered: