Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Clearing credentials on disconnect could cause issues #288

Closed
arthurnn opened this issue Jun 16, 2014 · 11 comments
Closed

Clearing credentials on disconnect could cause issues #288

arthurnn opened this issue Jun 16, 2014 · 11 comments

Comments

@arthurnn
Copy link
Contributor

On a failover retry, we could lose the credentials as they get cleared after a disconnect.
see

node.disconnect

credentials.clear

cc @jonhyman
[related #286]

@jonhyman
Copy link
Contributor

Thanks. I worked on this a bit on my train today, I'll finish it up when I'm back at a computer in the morning and submit the pulls sometime tomorrow.

@jonhyman
Copy link
Contributor

jonhyman commented Jul 2, 2014

@edejong can you point your app at https://github.com/jonhyman/moped, branch /feature/fix-credential-clear and see if you still have issues?

@edejong
Copy link

edejong commented Jul 4, 2014

Hey sorry for the late response, will try this weekend!

@jonhyman
Copy link
Contributor

jonhyman commented Jul 4, 2014

Sounds good, thanks!

@edejong
Copy link

edejong commented Jul 6, 2014

So far it seems I can't even reproduce the bug with the main repo so I can't say anything sensible yet. I'll leave it overnight and see if it disconnects. It only happened after a long time of inaction so please bear with me ;)

@edejong
Copy link

edejong commented Jul 8, 2014

Ok I've been able to reproduce the bug with the old version, it just takes a bit longer for it to occur than it used to which is good to know. Now testing with your branch, let's give it a full day at least.

@edejong
Copy link

edejong commented Jul 9, 2014

Unfortunately it still seems to happen using your branch:

failed with error 16540: "not authorized for insert on ..."

@jonhyman
Copy link
Contributor

jonhyman commented Jul 9, 2014

@edejong any way you can log some more info? I'm a bit confused as to how it would not have logged in. Before, you had said that apply_credentials as credentials == logins now, so it did not ever log in. But I removed all that at https://github.com/mongoid/moped/pull/291/files#diff-804e34c24aec99cb6acc5b0563656272L21 and it should always attempt a login unless it thinks it's already logged in.

@edejong
Copy link

edejong commented Jul 15, 2014

@jonhyman will add more info asap.

Strangely I seem to be having a similar problem with mongoid 3+moped 1.5. I'm hosting on ObjectRocket and using rails and unicorn. With mongoid 4 I get the not authorized error after leaving the server running for a long time without traffic. But with mongoid 3 under the same circumstances I get documents not persisting to the database, without errors, in safe mode. If I refresh the page that creates the document a couple of times after a while they slowly start persisting, it seems as if every unicorn process silently fails once before working properly again. In some ways this is even worse as I have no way of knowing an insert succeeded besides manually checking after creation. No idea if it is mongoid or moped yet, will have to test further; it is a pain to test as I have to wait a long time for disconnects. Was the reconnect code in mongoid 2 rewritten? Almost seems to imply something else is going wrong for me...

@jonhyman
Copy link
Contributor

Do you have firewall rules which might be killing persistent connections
and not sending a reset or something like that? Maybe your mongos needs
restarting? What do the ObjectRocket guys think?

Sent from my mobile device
On Jul 15, 2014 4:43 AM, "edejong" notifications@github.com wrote:

@jonhyman https://github.com/jonhyman will add more info asap.Strangely
I seem to be having a similar problem with mongoid 3+moped 1.5. I'm hosting
on ObjectRocket and using rails and unicorn. With mongoid 4 I get the not
authorized error after leaving the server running for a long time without
traffic. But with mongoid 3 I get documents not persisting to the database,
without errors, in safe mode. If I refresh the page that creates the
document a couple of times after a while they slowly start persisting, it
seems as if every unicorn process silently fails once before working
properly again. In some ways this is even worse as I have no way of knowing
an insert succeeded besides manually checking after creation. No

Reply to this email directly or view it on GitHub
#288 (comment).

@arthurnn
Copy link
Contributor Author

closing this as #324 was merged and it should solve this issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants