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

NotMasterNoSlaveOk #167

Closed
valeriomazzeo opened this issue May 9, 2018 · 9 comments
Closed

NotMasterNoSlaveOk #167

valeriomazzeo opened this issue May 9, 2018 · 9 comments

Comments

@valeriomazzeo
Copy link

I keep randomly getting this error, not sure what could be the cause:

MongoKitten.MongoError.invalidResponse([{\"ok\":0.0,\"codeName\":\"NotMasterNoSlaveOk\",\"errmsg\":\"not master and slaveOk=false\",\"code\":13435}])

Environment:

  • Mongodb 3.4.14 (Cloud Atlas)
  • MongoKitten 4.0.19
@Joannis
Copy link
Member

Joannis commented May 10, 2018

@valeriomazzeo It seems MongoKitten sent a query to one of the slaves. This is only possible for read queries where slaveOK is explicitly true. MongoKitten never sets slaveOK to true, so that explains the error. What query were you running?

@valeriomazzeo
Copy link
Author

I am not sure, as I was using Fluent, so this must be coming from the driver.
Also, restarting the web server fixed the issue. Any idea?

@Joannis
Copy link
Member

Joannis commented May 10, 2018

Yes. Your primary MongoDB server's node's connection went offline for whatever reason and MongoKitten (had to) switch to a secondary node. Probably picked the wrong one.

@valeriomazzeo
Copy link
Author

ok, so how could we prevent this to happen or to properly recover?

@valeriomazzeo
Copy link
Author

@Joannis ?

@Joannis
Copy link
Member

Joannis commented Jun 5, 2018

You can shutdown MongoKitten's server object and it'll reconnect the next query.

@valeriomazzeo
Copy link
Author

I suppose when using mongo-driver with fluent it should be the driver to take care of this?

@Joannis
Copy link
Member

Joannis commented Jun 5, 2018

The Fluent driver, yes.

@Joannis
Copy link
Member

Joannis commented Mar 22, 2019

I'm closing this, since it's a Fluent issue.

@Joannis Joannis closed this as completed Mar 22, 2019
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

No branches or pull requests

2 participants