hashicorp / go-plugin

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

Plugin client won't bootstrap successfully if the first message sent from plugin is not the negotiation format. #233

Open chenxi-neo opened 1 year ago

chenxi-neo commented 1 year ago

I'm now using go-plugin to develop some Golang applications and it works well. Except that if the first message the client received from the plugin is not the right format like: 1|1|tcp|127.0.0.1:1234|grpc, the client will not correctly negotiate with the plugin process . This is a bit strict if some plugin written in Golang import other third party libs that print something in the init function. image may be we could add some regex filter to extract the negotiate message from the plugin output? Or do we have better solution to deal with this problem?

skyf0cker commented 1 year ago

This also made me confused. We cannot guarantee that the third party module is designed to have no stdout in their init functions. Maybe we should find another way to negotiate a port to use for rpc. CC @evan2645 https://github.com/hashicorp/go-plugin/blob/a88a423a8813d0b26c8e3219f71b0f30447b5d2e/client.go#L503