10

Apologies in advance for the thin details on this one.

I sell a Magento extension. With the latest release, I've started getting an odd bug report from a few users. Specifically, after installing the extension, they report being unable to login to the admin, with login requests being redirected back to the login page, and without any error message displaying.

So, this sounds like the classic "can't set a cookie/instantiate a session" problem. Where this gets weird is they are able to login after 3 - 12 hours (that's an estimate). In other word, they encounter the problem, contact me for support, I write back, they report the problem has vanished. I also assume clearing their cookies and establishing a new session id will fix the problem, and recommend the same to users encountering it.

Has anyone here run into something similar, or can think of a reason this happens? I can't recreate the problem locally, but I've gotten enough reports that I'm convinced it's a legit problem.

  • 2
    Yes, I have this from time to time, after playing with the config, cookies, xdebug, etc. Cleaning the cookies helps. Don't ask me, what happens in details. – Fabian Blechschmidt Jun 18 '13 at 16:01
  • 2
    I experience this problem time to time. Clearing cookies helps. Not sure what is the root of this problem. Wild guessL: total cookie size for this domain exceeds limit and browser doesn't accept new cookie from magento after login. – Dmytro Zavalkin Jun 18 '13 at 16:07
  • 2
    I get this issue - it seems worse in Chrome than in FF (as in, it appears more frequently). Though I am on an older version on EE (1.10.1.1) so it might be unrelated. – Cheddies Jun 18 '13 at 16:08
  • 2
    I have this issue exclusively in Chrome. Clearing cookies helps, and, anecdotally the sites it appears to be worst on are file system session storage. Perhaps something related to garbage collection? – philwinkle Jun 18 '13 at 16:14
  • 2
    This could very well be related to the 'incorrect server time' bug. Chrome suffers from this especially, because it does extra validation on cookies. Ask your customers to sync time on their server. – Daniel Sloof Jun 18 '13 at 19:23
8

Ten months later, I'm pretty sure this bug was caused by instantiating a session object too early in Magento's request lifecycle (via an observer). If a session is instantiated too early, the PHP cookie name will be PHPSESSID instead of adminhtml or frontend.

This won't halt system operation, but in certain conditional code paths where a cookie's already been set it might cause a login token set in the session to be improperly read/written, leading to "I can't login" errors.

The full explanation is too long for a single Stack Exchange answer, but you can find it here if you're interested. (self-link)

2

As Daniel Sloof said ensure the time on the server is correct. This has prevented me from logging in in the past. After resetting the time on the server ensure to bin your sessions (and cache for good measure) from both your browser and the Magento installation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.