-
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
[Neo Core] Part 1. Isolate Plugins Exceptions from the Node. #3309
[Neo Core] Part 1. Isolate Plugins Exceptions from the Node. #3309
Conversation
@shargon this should be a bug right? |
Bad design |
Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com>
I'm not sure it improves things for users. The node will continue to work, sure, but if users have plugins they likely depend on them anyway (RPC/ApplicationLogs), so if node continues to process blocks, but users can't get data from it --- it's still broken from the user's perspective. It will also invalidate plugin state and will require subsequent resynchronization (right now updated nodes can just continue processing). |
One service down does not mean the whole node including other services should also down. You can't say our brain should stop working if our hand is numb. And one pr only fix one specific problem. This pr isolate the exception from plugin to the core, which i believe is definately a good design, otherwise any plugin can be an attack surface of the whole node. As to your concern please check #3311. But this is a good one, will update 3311 to make user able to config as stop the whole node. |
I think I will create a continue sync of state when missing data for |
} | ||
catch (Exception ex) | ||
{ | ||
Utility.Log(nameof(Plugin), LogLevel.Error, ex); |
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.
The problem I see is that if you have a plugin that uses states, and it fails, you can have a corrupted chain and still work
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 see, #3311 solve that problem
{ | ||
handlerAction(handler); | ||
} | ||
catch (Exception ex) when (handler.Target is Plugin) |
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.
we need this when? it's only used for plugins
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.
yes, need to check plugin exceptions seperately.
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.
What about create a branch and merge the other related PRs into this branch we review one by one ?
89d6ea3
into
neo-project:plugin-unhandled-exception
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 if #3311 is merged
* [Neo Core] Part 1. Isolate Plugins Exceptions from the Node. (#3309) * catch plugin exceptions. * add UT test * udpate format * make the test more complete * complete the ut test * format * complete UT tests with NonPlugin case * async invoke * Update src/Neo/Ledger/Blockchain.cs Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com> --------- Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com> * [Neo Plugin New feature] UnhandledExceptionPolicy on Plugin Unhandled Exception (#3311) * catch plugin exceptions. * add UT test * udpate format * make the test more complete * complete the ut test * format * complete UT tests with NonPlugin case * async invoke * stop plugin on exception * remove watcher from blockchain if uint test is done to avoid cross test data pollution. * add missing file * 3 different policy on handling plugin exception * add missing file * fix null warning * format * Apply suggestions from code review Clean * Update src/Neo/Plugins/PluginSettings.cs Co-authored-by: Shargon <shargon@gmail.com> * Update src/Neo/Plugins/PluginSettings.cs Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com> * Update src/Plugins/TokensTracker/TokensTracker.cs Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com> * Update src/Plugins/TokensTracker/TokensTracker.json --------- Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com> * make the exception message clear --------- Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com> Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: NGD Admin <154295625+NGDAdmin@users.noreply.github.com>
Description
Currently plugins and the core runs in the same process, and we lack the measure of handling the plugin exceptions. This makes any plugin can have the ability to block the whole node, turning plugin an attack surface for neo core. Issue #3296 is a typical example.
Fixes # #3296 (comment)
Type of change
How Has This Been Tested?
Test Configuration:
Checklist: