Skip to content
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 plugin exception #3426

Merged
merged 20 commits into from
Aug 6, 2024
Merged

Conversation

Jim8y
Copy link
Contributor

@Jim8y Jim8y commented Jul 18, 2024

Description

This pr reopens the plugin unhandled exception pr, and fixed the async delegate invocation calling.

Fixes # #3356

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • TestOnException

Test Configuration:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

src/Neo/Plugins/Plugin.cs Outdated Show resolved Hide resolved
src/Neo/Plugins/UnhandledExceptionPolicy.cs Outdated Show resolved Hide resolved
src/Plugins/LevelDBStore/Plugins/Storage/LevelDBStore.cs Outdated Show resolved Hide resolved
src/Plugins/LevelDBStore/Plugins/Storage/Snapshot.cs Outdated Show resolved Hide resolved
src/Plugins/LevelDBStore/Plugins/Storage/Store.cs Outdated Show resolved Hide resolved
Jim8y and others added 3 commits July 19, 2024 00:32
…plugin-exception

* 'fix-plugin-exception' of github.com:Jim8y/neo:
  Update src/Neo/Plugins/UnhandledExceptionPolicy.cs
  ensure leveldb is not used in multithread env
  Revert "Revert "Plugin unhandled exception (neo-project#3349)" (neo-project#3366)"

# Conflicts:
#	src/Neo/Ledger/Blockchain.cs
#	src/Neo/Plugins/UnhandledExceptionPolicy.cs
#	tests/Neo.UnitTests/Plugins/TestPlugin.cs
#	tests/Neo.UnitTests/Plugins/UT_Plugin.cs
src/Neo/Plugins/Plugin.cs Show resolved Hide resolved
src/Neo/Plugins/Plugin.cs Show resolved Hide resolved
cschuchardt88
cschuchardt88 previously approved these changes Jul 23, 2024
@Jim8y Jim8y requested a review from shargon July 23, 2024 11:19
@@ -3,7 +3,8 @@
"Path": "ApplicationLogs_{0}",
"Network": 860833102,
"MaxStackSize": 65535,
"Debug": false
"Debug": false,
"UnhandledExceptionPolicy": "StopPlugin"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better in almost all of them StopNode by default, is the current behaviour

Copy link
Contributor Author

@Jim8y Jim8y Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothoing was changed since the last review but the deledage invoke. Different plugin has different behavior on unhandled exception that are precisely set by superboy. Default behavior means nothing here.

src/Neo/Plugins/PluginSettings.cs Outdated Show resolved Hide resolved
src/Neo/Plugins/Plugin.cs Outdated Show resolved Hide resolved
src/Neo/Plugins/Plugin.cs Show resolved Hide resolved
cschuchardt88
cschuchardt88 previously approved these changes Jul 25, 2024
@Jim8y Jim8y requested a review from cschuchardt88 July 29, 2024 12:08
Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing right now.

using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What we have this requirement added?

// skip stopped plugin.
if (handler.Target is Plugin { IsStopped: true })
{
continue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the stopped plugin keep crashing nothing will be reported?

Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with OracleService and StateService on the same node, deployed Oracle functions and invoked. Everything is working even with StopNode as default.

@NGDAdmin NGDAdmin merged commit 1488958 into neo-project:master Aug 6, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants