Why could Rails be losing user session information after a redirect?

Viewed 125

I have a weird nondeterministic bug. When my user signs up for the first time, I do sign_in(:user, user) and then a redirect_to '/'. Before the redirect, I am logging user_signed_in? and it always shows true.

Now, in the controller route for '/', I am calling user_signed_in? and it sometimes returns false, directly after having returned true!

This happens much more often with short passwords.

I have checked there are no save errors on the user, and also that the passwords are long enough to pass Devise's checks.

What could be causing user_signed_in? to return true, and then SOMETIMES switch to false?

I have tried to put a breakpoint in https://github.com/heartcombo/devise/blob/master/lib/devise/controllers/helpers.rb#L123

but weirdly the breakpoint seems to be executed BEFORE the polymorphic code has been customised for user:

enter image description here

0 Answers
Related