Safari is losing it's cookies. Again. Or Still.
I've spent countless hours trying to debug our helpdesk software, only to finally reach the conclusion that Safari was simply losing it's cookies. Then I found a thread here, "Safari keeps logging me out..." and see that I'm hardly alone. I added to that (old) thread and it was recommended that I start the discussion again here.
The symptom is I log into the helpdesk. Some period of time later ranging from hours to days, I get an invalid login error (note that this is a web page that automatically refreshes every five minutes). Tracing the helpdesk code when this happens, I see that it has reached a point where it can find no valid authentication method, including cookies. In other words, it wasn't presented any cookies. I've debugged the helpdesk code that sets the cookies, and it only runs when it's supposed to, on initial login. The session id is still active in the helpdesk database. The software isn't unsetting these cookies.
The cookies disappear from the Show Cookies list in Preferences. They disappear from the Cookies.plist file. Other cookies which are older and expire sooner are not being deleted, so this doesn't look like some kind of house cleaning thing.
Based on the previous discussions, a lot of people seem to think this has something to do with size or number of cookies. I'm setting two cookies, which Web Inspector lists as 51 and 19 bytes respectively. There are two other active cookies for this web page, set by some other application with a more global domain name (e.g. I'm using helpdesk.foo.edu, and these cookies are for .foo.edu). The other two cookies list as 60 and 347 bytes. I'm hardly hitting any limits here. Overall there are about 30 cookies generally within the foo.edu domain, but most of these are limited to other subdomains.
One bit of weirdness here though, is that Web Inspector says "4 cookies (13.51KB)". Even in the long form storage in Cookies.plist, these four cookies only use about 2K, so maybe this is one big hint.
Here's a laundry list of other related facts:
- The cookies in question are set to expire in one year
- No one else here seems to be having this problem. Everyone else is on Linux.
- Currently: Safary 5.0.5, OSX 10.6.7.
- Problem existed on earlier versions of both Safari and OS X (but maybe only Snow Leopard?)
- No Safari extensions installed.
- Cookies.plist is around 4.5 MB
- My home is an NFS home directory
- I'm usually running next to nothing: Safari, Thunderbird, Terminal, X11
- Cookies can get lost at any time - when I'm actively browsing elsewhere, or when I've been away from the desk for hours.
- I don't see this anywhere else, but every other site I can think of either I use very short sessions (15 minutes, like banking or something), or I'm using session cookies (e.g. Twitter I don't ask it to remember my login).
tom