Unable to login


#1

Hello everybody,
Sometimes my app’s login got stuck with no error so that I couldn’t log in even if the login page was displayed.
Actually loginToken for the user is created and saved to the db.

Some considerations:
1- This happens not when my app usage peaks.
2- During the issue I don’t notice any performance problem for other users.
3- This happens only with login-logout methods.
4- If I put wrong login credentials the callback fires immediately saying ‘wrong pass’ or 'user not found’
5- When I delete manually loginToken from the mongodb shell during stuck, client fires “You have been logged out by the server” message

One of the login traces from kadira

This is from the chrome’s console. ‘add’ message for users collection arrives over ddp, but loginWithPassword callback
doesn’t fire it’s callback.
Also in the last line I see login token:
web socket frames

This is the answer of Serkan Durusoy from the meteor-talk group:

Do you observe this behaviour only on your live system or could you be able to replicate the issue on a test/staging environment?

You could try using github.com/meteorhacks/unblock to create and explicit user publication and unblocking it while wrapping user related publications with if (this.userId) {/* pub */} to see what this breaks. It will sure break some of your publications since the user publication will not have been ready by then. But it will also simplify your case to a limited number of subscriptions.

But that’s just a hack that I came up with by instinct.

I’d suggest properly debugging the app, looking for extraordinary patterns at the time of the problem.

Again, you’d need to set up some testing environment and make sure you are able to reproduce the problem.

I am going to set a test/staging environment today, and try to replicate the issue there.


#2

I set staging environment but I was unable to reproduce the issue in that environment.
I investigated in the production environment and found that:

1- During the issue Meteor.loggingIn() gives true.
2- db.users.services.resume.loginToken contains when and hashedToken
3- If I copy token from the socket frame and refresh the page, open console and paste the token as the first argument to
the Meteor.loginWithToken() method, login takes place!


#3

I have removed all subscriptions right before and after the login process but the problem continues to exist. I am still unable to reproduce the issue, so I can’t debug properly.


#4

One ulterior consideration:
During the issue, if I give: Meteor.disconnect() then Meteor.reconnect() in the browsers’ console, I can login. I am still unable to reproduce the issue.
I have removed the logout button from my app, so my users cannot logout. It is very embarrassing for me. :frowning:


#5

We just encountered this issue and unfortunately have no additional details. We experienced the same behavior. A loginToken is created but the loginWithPassword callback was never called. There were no errors in the server logs or browser console. Kadira also didn’t report anything.

Additional things we experienced:

  1. Try to login with account that has this issue.

  2. Try to login with account that doesn’t have this issue

  3. Login fails with no error messages.

  4. Refresh browser

  5. Login with account without the issue.

  6. Login successful for the account without the issue.

  7. Account with issue continues to have issue.

The only way we could resolve this issue was to restart the app.

We’re assuming this will be hard to track down since there’s no logs and it’s hard to reproduce. Just throwing this out there in hopes we can narrow it down one day.