-
Notifications
You must be signed in to change notification settings - Fork 1k
add more log to load plugin #4363
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
base: master-n3
Are you sure you want to change the base?
add more log to load plugin #4363
Conversation
|
Related to issue neo-project/neo-node#940 |
vncoelho
left a comment
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.
very good, @ajara87 , do you think we should set a config for neo-cli to make this log of this is good as default?
I will test asap
src/Neo/Plugins/Plugin.cs
Outdated
| } | ||
|
|
||
| private static void LoadPlugin(Assembly assembly) | ||
| private static void LoadPlugin(Assembly assembly, string? sourcePath = null) |
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 assembly name is not enough?
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 think it's enough
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.
Then please remove the sourcePath.
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.
In most cases the assembly name is enough but in practice there are situations where multiple plugin DLLs share the same assembly name (for example, different versions or copies deployed under different plugin subfolders or mounted volumes).
In those cases the log becomes ambiguous if it only shows the assembly name. Including the file path in the log tells the operator exactly which physical DLL failed.
In this case It's just additional information but for me is ok I'll remove it.
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 am going to test it right now and return to you guys
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.
ERROR [11:18:20.520] Failed to load plugin assembly /opt/node/Neo.CLI/Plugins/SignClient/Grpc.Net.Client.dll
ERROR [11:18:20.540] System.TypeLoadException
Could not load type 'Grpc.Core.ConnectivityState' from assembly 'Grpc.Net.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d754f35622...in.cs:line 176
NEO-CLI v3.9.0 - NEO v3.9.0 - NEO-VM v3.9.0
neo> Unhandled exception. System.TypeInitializationException: The type initializer for 'Neo.NeoSystem' threw an exception.
---> System.TypeLoadException: Could not load type 'Grpc.Core.ConnectivityState' from assembly 'Grpc.Net.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad'.
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at Neo.Plugins.Plugin.LoadPlugin(Assembly assembly, String sourcePath) in /opt/neo/src/Neo/Plugins/Plugin.cs:line 176
at Neo.Plugins.Plugin.LoadPlugins() in /opt/neo/src/Neo/Plugins/Plugin.cs:line 228
at Neo.NeoSystem..cctor() in /opt/neo/src/Neo/NeoSystem.cs:line 112
--- End of inner exception stack trace ---
at Neo.NeoSystem.CurrentDomain_UnhandledException(Object sender, UnhandledExceptionEventArgs e) in /opt/neo/src/Neo/NeoSystem.cs:line 185
at System.AppContext.OnUnhandledException(Object e)
/opt/start_node.sh: line 2: 95 Aborted (core dumped) ( cd /opt/node/Neo.CLI/; dotnet neo-cli.dll )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.
It looks make better @ajara87
It would be even better if we could print * dlls details as well, if there is something easy to extract.
Anyway, maybe this is good for now, what we need some locks.
Maybe check if the *.dlls was already loaded or is being loaded.
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 prefer as reported here above, @shargon @erikzhang
neo> FATAL [11:21:36.286] System.IO.IOException
Failed to bind to address http://0.0.0.0:30337: address already in use.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.EndpointsStrategy.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__14_1(IHostedService service, CancellationToken token)
at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Start(IHost host)
at Neo.Plugins.RpcServer.RpcServer.StartRpcServer()
at Neo.Plugins.RpcServer.RpcServerPlugin.OnSystemLoaded(NeoSystem system)
at Neo.NeoSystem..ctor(ProtocolSettings settings, IStoreProvider storageProvider, String storagePath) in /opt/neo/src/Neo/NeoSystem.cs:line 153
at Neo.NeoSystem..ctor(ProtocolSettings settings, String storageProvider, String storagePath) in /opt/neo/src/Neo/NeoSystem.cs:line 128
at Neo.CLI.MainService.Start(CommandLineOptions options) in /opt/neo-node/src/Neo.CLI/CLI/MainService.cs:line 370
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__124_1(Object state)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
Microsoft.AspNetCore.Connections.AddressInUseException
Address already in use
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory.BindAsync(EndPoint endpoint, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.TransportManager.BindAsync(EndPoint endPoint, ConnectionDelegate connectionDelegate, EndpointConfig endpointConfig, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<>c__DisplayClass28_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
System.Net.Sockets.SocketException
Address already in use
at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions.CreateDefaultBoundListenSocket(EndPoint endpoint)
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
Unhandled exception. System.IO.IOException: Failed to bind to address http://0.0.0.0:30337: address already in use.
---> Microsoft.AspNetCore.Connections.AddressInUseException: Address already in use
---> System.Net.Sockets.SocketException (98): Address already in use
at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions.CreateDefaultBoundListenSocket(EndPoint endpoint)
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory.BindAsync(EndPoint endpoint, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.TransportManager.BindAsync(EndPoint endPoint, ConnectionDelegate connectionDelegate, EndpointConfig endpointConfig, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.<>c__DisplayClass28_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.EndpointsStrategy.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__14_1(IHostedService service, CancellationToken token)
at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Start(IHost host)
at Neo.Plugins.RpcServer.RpcServer.StartRpcServer()
at Neo.Plugins.RpcServer.RpcServerPlugin.OnSystemLoaded(NeoSystem system)
at Neo.NeoSystem..ctor(ProtocolSettings settings, IStoreProvider storageProvider, String storagePath) in /opt/neo/src/Neo/NeoSystem.cs:line 153
at Neo.NeoSystem..ctor(ProtocolSettings settings, String storageProvider, String storagePath) in /opt/neo/src/Neo/NeoSystem.cs:line 128
at Neo.CLI.MainService.Start(CommandLineOptions options) in /opt/neo-node/src/Neo.CLI/CLI/MainService.cs:line 370
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__124_1(Object state)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
/opt/start_node.sh: line 2: 141 Aborted (core dumped) ( cd /opt/node/Neo.CLI/; dotnet neo-cli.dll )
root@3acab277a648:/opt/node/Neo.CLI/Plugins/SignClient# root@neocompiler:~/neocompiler-server/neocompiler.io# This is the error of a duplicated RpcServer.dll in different Plugins folder, such as those that use it as dependencies. |
|
@ajara87 , for one case it helped, but for the duplicated RpcServer dll in different Plugins folder it still do not give much information, just that we have duplicated service on that port. |
Maybe verify for if improve log for duplicated RpcServer dlls
|
Maybe , in the specific case of the RpcServer duplicated, we need something to avoid loading a duplicated * dlls, a flag that says it is "loading"/"loaded" |
|
What is the problem with the location as @ajara87 initially designed. Now it is bad and still missing important information on location ERROR [17:13:05.523] Failed to load plugin assembly Grpc.Net.Client: System.TypeLoadException: Could not load type 'Grpc.Core.ConnectivityState' from assembly 'Grpc.Net.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d754f35622...in.cs:line 177
NEO-CLI v3.9.0 - NEO v3.9.0 - NEO-VM v3.9.0
neo> Unhandled exception. System.TypeInitializationException: The type initializer for 'Neo.NeoSystem' threw an exception.
---> System.TypeLoadException: Could not load type 'Grpc.Core.ConnectivityState' from assembly 'Grpc.Net.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad'.
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at Neo.Plugins.Plugin.LoadPlugin(Assembly assembly) in /opt/neo/src/Neo/Plugins/Plugin.cs:line 177
at Neo.Plugins.Plugin.LoadPlugins() in /opt/neo/src/Neo/Plugins/Plugin.cs:line 223
at Neo.NeoSystem..cctor() in /opt/neo/src/Neo/NeoSystem.cs:line 112
--- End of inner exception stack trace ---
at Neo.NeoSystem.CurrentDomain_UnhandledException(Object sender, UnhandledExceptionEventArgs e) in /opt/neo/src/Neo/NeoSystem.cs:line 185
at System.AppContext.OnUnhandledException(Object e)
/opt/start_node.sh: line 2: 120 Aborted (core dumped) ( cd /opt/node/Neo.CLI/; dotnet neo-cli.dll ) |
vncoelho
left a comment
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.
As it is it does not improve much readability, the first version was better.
What are the problems in printing location?
Description
Improve plugin loading diagnostics by logging the assembly path when plugin type loading fails. Adding log in
LoadPluginsandLoadPluginChange Log
Plugin.csclassFixes # (issue)
Type of change
How Has This Been Tested?
Checklist: