hashicorp / go-plugin

Golang plugin system over RPC.
Mozilla Public License 2.0
5.25k stars 450 forks source link

gRPC server supports `PanicHandler` #319

Open magodo opened 2 days ago

magodo commented 2 days ago

Supports PanicHandler for the gRPC server to allow users to handle the panic at the plugin side instead of directly down.

Currently, when the plugin panics, the panic is captured only by the stderr rpc channel, which is then logged by the client side with "DEBUG" log level. In most cases, the panic information should be of the "ERROR" log level by the definition of log level. This PanicHandler can help with that. In some other cases, this hook allows users to do other handling when the provider crashes.