-
Notifications
You must be signed in to change notification settings - Fork 1k
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: concurrency conflict in MemPool.TryRemoveUnVerified #3500
fix: concurrency conflict in MemPool.TryRemoveUnVerified #3500
Conversation
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.
Require testing
A unit test added |
In real environment, please @superboyiii could you test it? |
SuperBoy is on travel, wont be back until 26th. |
Sure. |
I have doubts on this. Neo uses Akka actors to avoid locks. It was said that a single Akka actor processes only 1 message at any time. This means that no multiple instances of an actor is running. And At the definition of
I am even doubting why write locks are needed, and whether the existing locks are necessary. |
|
@@ -747,6 +747,25 @@ public void TestUpdatePoolForBlockPersisted() | |||
_unit.VerifiedCount.Should().Be(0); | |||
} | |||
|
|||
[TestMethod] | |||
public void TestTryRemoveUnVerified() |
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.
how could this test the conflict?
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.
Race condition is hard to test.
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.
Tested OK.
|
||
_unit.SortedTxCount.Should().Be(0); | ||
|
||
foreach (var tx in txs) |
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.
maybe _unit.UnVerifiedCount.Should().Be(32);
before the loop
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.
good change
Description
Fixes #3499
Type of change
Checklist: