-
Notifications
You must be signed in to change notification settings - Fork 202
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 pool++limits #1767
Fix pool++limits #1767
Conversation
# Conflicts: # dataRetriever/factory/txpool/txPoolFactory_test.go # dataRetriever/txpool/shardedTxPool.go # dataRetriever/txpool/shardedTxPool_test.go # storage/txcache/config.go # storage/txcache/eviction_test.go # storage/txcache/txCache_test.go # storage/txcache/txListForSender_test.go
SizeInBytes = 524288000 | ||
SizeInBytesPerSender = 12288000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only 12MBs per sender ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this is a much larger limit (x20) than we originally thought of (~600kb). I've used this (high) limit to ease testing via TxGen. After some rounds of testing, we can lower it to ~600kb & 1000 txs per sender. @AdoAdoAdo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of having bigger limits. In case of smart contracts, oracle's this limit is too small.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those verification should be done with > then a base constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System tests passed.
This branch will contain fixes applied on top of
pool++limits
.Original
pool++limits
PR: #1716Helpers to diff with original PR:
pool++limits
carve-outpool++limits
carve-outgit diff b94e466a827e78b7663f45ccfe1af0fa721680b2 -- dataRetriever/txpool/ pool++limits-fixed -- dataRetriever/txpool/
git diff b94e466a827e78b7663f45ccfe1af0fa721680b2 -- storage/txcache/ pool++limits-fixed -- storage/txcache/
Narrative of the bug on
pool++limits
Bug behavior: missing transaction
0xabba
is requested, resolved, but never added to cache, which results in it being requested again - functional deadlock.Two conflicting goroutines concur to add a transaction the same one -
hash=0xabba
- in the cache. Say this is the first transaction of a sender (for example, due to a recent sender sweeping).txListBySenderMap.getOrAddListForSender
, obtains a list objectID=0xABCD
and inserts the transactionID=0xAAAA
withhash=0xabba
txListBySenderMap.getOrAddListForSender
, obtains (a different) a list objectID=0xDCBA
and inserts the transactionID=0xBBBB
withhash=0xabba
ID=0xAAAA
.ID=0xABCD
[(ID=0xAAAA, hash=0xabba)]
will be lost forever from memory.ID=0xDCBA
[(ID=0xBBBB, hash=0xabba)]
will be saved in the map by senders.hash=0xabba
. This is found in the map by hashes, with pointerID=0xAAAA
, and removed. ObjectID=0xAAAA
is then searched in the list objectID=0xDCBA
. The pointer comparison intxListForSender.findListElementWithTx
fails to find the transaction withhash=0xabba
. Not removed - bug,(ID=0xBBBB, hash=0xabba)
stays there - bug.hash=0xabba
. This is not found in the map by hashes (recently deleted, previous step), thus the transaction is requested from others. The transaction arrives.hash=0xabba
cannot be inserted in the cache, as the de-duplication logic intxListForSender.findInsertionPlace()
detects duplication.Fixes
Independent transaction removal in both structuresnot possible.bytes.Equal(hash of a, hash of b)
to compare transactions.txListForSender
.Can be tested using these log levels: