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 exception due to concurrent access of MethodHashes. #527

Merged
merged 4 commits into from Dec 19, 2018

Conversation

2 participants
@jsolman
Copy link
Contributor

jsolman commented Dec 19, 2018

Fixed this exception:

[ERROR][12/19/18 7:06:42 AM][Thread 0006][akka://NeoSystem/user/$a] Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
Cause: System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at Neo.SmartContract.Helper.ToInteropMethodHash(String method) in .../neo/SmartContract/Helper.cs:line 78
   at Neo.SmartContract.StandardService.Register(String method, Func`2 handler) in .../neo/SmartContract/StandardService.cs:line 112
   at Neo.SmartContract.NeoService..ctor(TriggerType trigger, Snapshot snapshot) in .../neo/SmartContract/NeoService.cs:line 89
   at Neo.SmartContract.ApplicationEngine..ctor(TriggerType trigger, IScriptContainer container, Snapshot snapshot, Fixed8 gas, Boolean testMode) in .../neo/SmartContract/ApplicationEngine.cs:line 62
   at Neo.SmartContract.Helper.VerifyWitnesses(IVerifiable verifiable, Snapshot snapshot) in .../neo/SmartContract/Helper.cs:line 117
   at Neo.Network.P2P.Payloads.Transaction.Verify(Snapshot snapshot, IEnumerable`1 mempool) in .../neo/Network/P2P/Payloads/Transaction.cs:line 319
   at Neo.Network.P2P.Payloads.InvocationTransaction.Verify(Snapshot snapshot, IEnumerable`1 mempool) in .../neo/Network/P2P/Payloads/InvocationTransaction.cs:line 65
...

@jsolman jsolman requested review from erikzhang and igormcoelho Dec 19, 2018

erikzhang added some commits Dec 19, 2018

@erikzhang

This comment has been minimized.

Copy link
Member

erikzhang commented Dec 19, 2018

@jsolman I made some changes, and if you feel that there is no problem, you can merge.

@jsolman

This comment has been minimized.

Copy link
Contributor

jsolman commented Dec 19, 2018

I think it is fine. We could preload the dictionary though so we don’t have to worry about concurrent access.

@jsolman jsolman merged commit f6b7895 into master Dec 19, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@erikzhang erikzhang deleted the ProtectMethodHashes branch Dec 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment