Note: This blog post is from 2009. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
If you use Firefox and have found it losing cookies, this will interest you. Even if you don't use FF, and experience the problem on Chrome, IE, Opera, Safari, etc., the root of the problem and a possible manual solution may interest you.
Of browser point releases, why it's worth paying attention
So Firefox 3.0.7 landed on my machine today as an auto update. Like me, you may find that these point releases aren't too much to write home (or blog) about. Often it's things like adding "Estonian, Kannada, and Telugu" language support. No offense to them, of course, but it's not something to get me get excited.
Still, I watch the release notes whenever a new release is pushed (just like I comb more carefully the far more interesting release notes for any new CF release), as you never know what surprise may be in store.
A fix in FF 3.0.7 seems the solution
Today, my reading the release notes paid off. There's word of a fix to the problem that's the subject of this blog entry:
"For some users, cookies would appear to go "missing" after a few days (bug 444600)."
Well heck yeah. It's been really annoying. And reading into that also showed how to solve the problem in other browsers.
What I was experiencing
Just like those in the support team (discussing the problem in the bug note), I would find that every couple of weeks various sites I visit often would have lost their cookies.
For instance, I set my Google search result preferences so that I see 30 search results at a time, rather than the default of 10. Suddenly it would be reset, which was very noticeable.
Or my bank would suddenly act like I'd visited the site for the first time on my laptop (when I'd used it just last week), and it make me go through extra authentication. That was annoying.
I knew it had to be a problem of the cookies being lost, but none of the obvious things were the problem. It was a nuisance, but not the end of the world.
The problem was not caused by what fellow troubleshooters may presume
Before pointing out the solution, I'll note that some may put on their debugging hats and wonder about what might have been other possible causes. It would have been easy to suspect a lot of things when faced with this problem.
Was it that the cookies being set (and lost) just had a suddenly early expiration date? Well, no, that wasn't it. (And these were major sites, like Google, my bank, etc. They don't make such mistakes, at least not more than once, typically.)
You might wonder if it was something I was doing on my system. No, I wasn't clearing out cookies. I just don't have call to do that, though I know some do when facing some development challenges.
I also don't regularly run any tools that might have been doing this for me, such as registry cleaners, anti-virus tools, etc. (And no, I don't run an AV tool all the time, and I've never suffered for it. I'll blog about that in a future note.)
So, sure, good to do the diagnostics. And an A for your effort, but it wasn't the problem. (BTW, this troubleshooting and helping people think through problems and use diagnostics is indeed what I do for a living now, helping people solve problems related to CF, so I really do respect and appreciate those who try to solve things on their own first. But if you do that and still have a problem, or can't take the time or don't know where to look, I can help.
The root cause, and learning more
So, back to the fix, it's great to see this it may well have been due to this issue now recognized and fixed in FF 3.0.7, which basically comes down to a combination (explained well in the bug note) of both a low default for how many cookies FF should keep (1000) and an eviction algorithm that didn't take into account how recently you'd visited a site before kicking it out when the limit was reached. Very nice.
You can learn more about the release, and get it if you've not auto-received it yet, here.
Oh, and if you want to up the number without applying the fix, the setting is called network.cookie.maxNumber, and you can tweak it using about:config (in FF), to access the underlying configuration settings.
As always with such tweaks, be careful. And naturally, raising the limit could eventually cause FF to take up a little more space in its repository to hold permanent cookies, and in memory. The bug note reports an estimate of about 1-2m per number increased, FWIW, so forewarned is forearmed.
What if you're not on FF?
As for those using Chrome or other browsers, note that you may find the same default setting of 1000 is limiting you. Whether and how to set it may vary, of course. Chrome, for instance, offers no about:config or other seeming way to edit its config settings (correct me if that's changed.)
I looked briefly and couldn't find how to set this in IE, Safari, or Opera, but if anyone reading this finds it, please share as a comment.
A couple of bonus tips
A couple of final observations: the bug note talks about how to get an interface tool for querying the underlying SQLite database, including SQL statements for detecting most recently accessed cookies,etc. Interesting to explore.
I also wanted to talk about an interesting observation from seeing discussions that took place from people trying to solve this problem. It's an interesting case study in troubleshooting and where one can go wrong. And I wanted to explain why changing the Google preference from 10 to 30 is a good idea. This has gotten way long, so I'll write those up as separate entries.