fix NeoSystem shutdown order#2842
fix NeoSystem shutdown order#2842shargon merged 2 commits intoneo-project:masterfrom ixje:fix-applog-losing-state
Conversation
|
Due to my test, some issues still exist.
mainnet seed node I will take a look at StatesDumper plugin while I finished resyncing full data of mainnet. In previous version, it will surely lose data after being interupted by |
|
I've not encountered this shutdown error myself, but somebody else inside coz has so we'll need to investigate further. |
|
It seems like plugins cannot call public void Dispose()
{
EnsureStopped(LocalNode);
// Dispose will call ActorSystem.Terminate()
ActorSystem.Dispose();
ActorSystem.WhenTerminated.Wait();
foreach (var p in Plugin.Plugins) <- TooLate
p.Dispose();
HeaderCache.Dispose();
store.Dispose();
}Moving it up like shown next resolves that exception. public void Dispose()
{
EnsureStopped(LocalNode);
// Dispose will call ActorSystem.Terminate()
foreach (var p in Plugin.Plugins) <- OK
p.Dispose();
ActorSystem.Dispose();
ActorSystem.WhenTerminated.Wait();
HeaderCache.Dispose();
store.Dispose();
}but then blocks still get persisted e.g. I can fix this by adding an public void Dispose()
{
EnsureStopped(LocalNode);
EnsureStopped(Blockchain);
// Dispose will call ActorSystem.Terminate()
ActorSystem.Dispose();
ActorSystem.WhenTerminated.Wait();
foreach (var p in Plugin.Plugins)
p.Dispose();
HeaderCache.Dispose();
store.Dispose();
}to get Now I still have to fix the exception that this causes when syncing from an offline chain. |
|
@superboyiii this should be it. The exception during offline chain sync I was seeing was due some change I did to the offline syncing system and does not apply to the default system. Can you help test this please? :) |
Sure. I'm doing that. |
superboyiii
left a comment
There was a problem hiding this comment.
@ixje Nice fix! The exception and the inconsistent StateService issue has gone. For StatesDumper, I think it's another issue.
|
For StatesDumper, I think the issue comes from neo-project/neo-modules#568 (comment) |
|
Thanks. This fixed my problem, too. #2624 |


fix neo-project/neo-modules#786
What I theorize is happening is that while the plugins are disposed (and they remove their
Committing/Committedhandlers) in the background the main persist loop continues to add blocks and transactions. The plugins (like app log) no longer process these blocks hence we lose data. By first shutting down the "main loop" we ensure plugins don't miss anything.