OAuth, Magento, Cookies, Ubuntu and Time

After upgrading my VMWare host (and some Ubuntu updates at the same time) I started noticing some strange behaviour on my Magento platform in QA. I just couldn’t login with my regular test user account. After clearing cookies on the browser, Magento started redirecting me to it’s “Please enable cookies” page. Boom! Nothing else had changed between stopping work on Monday and then resuming work on Tuesday. Frustrated, I simply created a new account and carried on using the new test account. That soon bombed though; mid workflow…

Now as if that wasn’t mysterious enough, my Twitter OAuth integrations started falling over. I really thought it was Monday- but it was actually Thursday. Not less than 45 minutes ago, a work items which had passed QA and committed to the repo was now suddenly failing. At the same time, my Magento session expired and I couldn’t login again. Wait a minute…

Both the OAuth error message and the Magento error were pointing to clock-synch issues. Could it be? Short answer: yes.

Now NTP is set to run automatically on the Ubuntu machine, but that wasn’t cutting it somehow. So i stopped that daemon, run ntpdate manually, and walah! Zee problem vas gone. Turns out my server was 5 minutes behind schedule.

So somewhere between the host clock, the VMWare time synch mechanism, the Ubuntu (11.04) updates and the NTP daemon- i’m still losing time.. somehow. I haven’t tracked down the culprit specifically, but at least the cause correlates with the symptoms and the appropriate fix is related to and resolves the issue.

The hunt will continue once this current story is completed….