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

Try reconnecting Mongo on EOF #3269

Merged
merged 3 commits into from
Aug 31, 2017
Merged

Try reconnecting Mongo on EOF #3269

merged 3 commits into from
Aug 31, 2017

Conversation

jefferai
Copy link
Member

This was an attempt to fix #2973. It appears not to work, for reasons that are not at all apparent (this checks for the error string containing "EOF" which is the exact error string printed in the logs), but it also doesn't seem like a bad thing to include anyways.

@jefferai jefferai added this to the 0.8.2 milestone Aug 31, 2017
if err != nil {
switch err {
case nil:
case io.EOF || strings.Contains(err.Error(), "EOF"):
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to compare err with io.EOF? I wonder if this will compile since io.EOF does not return a bool.

Copy link
Member Author

Choose a reason for hiding this comment

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

io.EOF is the following:

var EOF = errors.New("EOF")

As such I am indeed trying to compare it directly, but in case it's simply another actual error type that contains EOF in its string, I'm also doing the string check.

Copy link
Member

Choose a reason for hiding this comment

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

Since its a error object and not a bool, I suspect if this will compile.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be a comma instead of a ||?

Copy link
Member Author

Choose a reason for hiding this comment

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

So you're totally right about that, which is really amusing because the original reporter swore that he'd tried this branch and it didn't fix his problem. I'm suspicious.

briankassouf
briankassouf previously approved these changes Aug 31, 2017
Copy link
Contributor

@briankassouf briankassouf 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 other then that one comment by Vishal

Copy link
Member

@vishalnayak vishalnayak left a comment

Choose a reason for hiding this comment

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

LGTM!

@jefferai jefferai merged commit 2748d9b into master Aug 31, 2017
@jefferai jefferai deleted the mongo-reconnect branch August 31, 2017 20:50
chrishoffman pushed a commit that referenced this pull request Sep 1, 2017
* oss/master:
  Plugin Version Update (#3275)
  Lazy-load plugin mounts (#3255)
  changelog++
  changelog++
  Add pki/root/sign-self-issued. (#3274)
  Travis, be happier please
  changelog++
  Change auth helper interface to api.Secret. (#3263)
  changelog++
  Try reconnecting Mongo on EOF (#3269)
  Don't append a trailing slash to the request path if it doesn't actually help find something (#3271)
  changelog++
  Use TypeDurationSecond for TTL values in PKI. (#3270)
  changelog++
  changelog++
  Use net.SplitHostPort on Consul address (#3268)
  Normalize plugin_name option for mount and enable-auth (#3202)
  Updating Okta lib for credential backend (#3245)
  Explicitly mention that aws/aws-ec2 were unified under aws.
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.

Databases/MongoDB - error 500 on creds generation when mongodb replicaset primary step-down
3 participants