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

Provide a context for managing the lifecycle of gRPC plugins #55

Merged
merged 5 commits into from
Jan 18, 2018

Conversation

briankassouf
Copy link
Member

@briankassouf briankassouf commented Jan 18, 2018

If a plugin server goes away, gRPC clients will wait in the connecting and transient_failure states for some time (see https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md). This PR provides a context to the host process that will be canceled when go-plugin detects the plugin process has exited. If the host process detects the context has been closed it can take steps to recover.

Copy link
Member

@calvn calvn left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

Looks good.

client.go Outdated
@@ -457,6 +462,8 @@ func (c *Client) Start() (addr net.Addr, err error) {

// Close the logging channel since that doesn't work on reattach
close(c.doneLogging)
// Cancel the context
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick to add a blank line above here

@briankassouf briankassouf merged commit 485ef45 into master Jan 18, 2018
@briankassouf briankassouf deleted the plugin-context branch January 18, 2018 20:53
briankassouf pushed a commit that referenced this pull request Mar 14, 2018
This commit fixes the plugin-go-grpc example to use the updated
GRPCPlugin interface introduced in #52 and #55.

Prior to this change attempts to initialise the plugin would fail
with an `is not a GRPC-compatible plugin` error.

Signed-off-by: John McCabe <john@johnmccabe.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants