Last Comment Bug 470578 - corrupt cookies.sqlite prevents db opening
: corrupt cookies.sqlite prevents db opening
Status: RESOLVED FIXED
: fixed1.9.1, verified1.9.0.9
Product: Core
Classification: Components
Component: Networking: Cookies (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: dwitte@gmail.com
:
Mentors:
: 475355 488644 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-20 12:18 PST by dwitte@gmail.com
Modified: 2009-10-29 09:52 PDT (History)
15 users (show)
dveditz: wanted1.9.0.x+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch v1 (6.74 KB, patch)
2008-12-21 03:30 PST, dwitte@gmail.com
sdwilsh: review+
mconnor: superreview+
mbeltzner: approval1.9.1+
dveditz: approval1.9.0.9+
Details | Diff | Review

Description dwitte@gmail.com 2008-12-20 12:18:43 PST
zzxc sent me a corrupt cookies.sqlite from a user, which i tested against the cookieservice. when we first open the db connection, we check if it returned NS_ERROR_FILE_CORRUPTED and nuke the db; however, in this case it gets through that part but fails later on, in Read(), when we execute a statement to purge the db of expired cookies. (this makes sense, since it's at that point where sqlite actually traverses the whole db.)

this is easy to fix, and should help users who're getting corrupt db problems. it'll be a low-risk fix, so we should probably take it on trunk, 1.9.1, and 1.9.0 branches. patch forthcoming...
Comment 1 dwitte@gmail.com 2008-12-21 03:30:12 PST
Created attachment 354038 [details] [diff] [review]
patch v1

if anything fails with NS_ERROR_FILE_CORRUPT along the way from opening the db to reading in the data, nuke it and create from scratch. (also tweaks the error propagation of ImportCookies(), since a non-existent cookies.txt shouldn't log an error.)

we could be more picky about where we're interested in NS_ERROR_FILE_CORRUPT (e.g. only on db open or Read()), but this is pretty simple and works...
Comment 2 [:Cww] 2008-12-21 19:31:30 PST
At least 15 cases of locked/corrupt cookies a week leading to weird login issues/error messages or redirect loop messages.
Comment 3 dwitte@gmail.com 2008-12-21 19:36:03 PST
i'm not sure what's causing the locking problem - any ideas? the OS should clean up file locks on app crash, no?
Comment 4 Shawn Wilsher :sdwilsh 2008-12-21 19:46:18 PST
places has had issues with the database being locked by virus scanners.  Also, since you want an exclusive lock, things could be full of fail...
Comment 5 Shawn Wilsher :sdwilsh 2009-01-05 07:37:20 PST
Comment on attachment 354038 [details] [diff] [review]
patch v1

r=sdwilsh
Comment 6 Mike Connor [:mconnor] 2009-02-03 18:51:04 PST
Comment on attachment 354038 [details] [diff] [review]
patch v1

yeah, looks ok, but the cookieFile reuse makes me twitchy.  I know it's fine, and not in scope anyway, but it feels like some rope that's just looking to hang someone.
Comment 7 dwitte@gmail.com 2009-02-03 19:04:38 PST
Comment on attachment 354038 [details] [diff] [review]
patch v1

thanks mconnor, i'll tweak the var name on checkin.

requesting approval for 1.9.0 and 1.9.1 branches... see comment 2 for upside; this patch basically means that if a user gets a corrupt db for some reason, we'll detect and delete it on startup rather than requiring them to intervene by deleting it themselves. (we can do something to make corruption occur less often too, but that'll be later.)
Comment 8 dwitte@gmail.com 2009-02-03 19:28:25 PST
landed on trunk.
Comment 9 Daniel Veditz [:dveditz] 2009-02-20 11:53:15 PST
I'd love to fix this common complaint in a 1.9.0 release, but I'd be happier taking it if it's been tested by reasonable numbers of people in a 1.9.1 nightly or, better, beta release.
Comment 10 Nochum Sossonko [:Natch] 2009-03-01 11:04:15 PST
*** Bug 475355 has been marked as a duplicate of this bug. ***
Comment 11 Mike Beltzner [:beltzner, not reading bugmail] 2009-03-09 11:50:17 PDT
Comment on attachment 354038 [details] [diff] [review]
patch v1

a191=beltzner
Comment 12 dwitte@gmail.com 2009-03-09 18:06:48 PDT
landed on 1.9.1 branch. we can let this bake more before taking on 1.9.0.
Comment 13 Daniel Veditz [:dveditz] 2009-03-16 15:08:30 PDT
Comment on attachment 354038 [details] [diff] [review]
patch v1

Approved for 1.9.0.8, a=dveditz for release-drivers
Comment 14 Daniel Veditz [:dveditz] 2009-03-17 23:26:17 PDT
Checked in to the 190 branch for dwitte.
Comment 15 ked2 2009-03-20 10:43:57 PDT
I just _started_ to have problems with cookies when this bug was "fixed." Just for the last few days whenever I go to Facebook, Netflix, or any other site in which I previously have always stayed logged in, I am not logged in. I double-checked my preferences and nothing has changed there: it says "accept cookies" and "accept 3rd party cookies."
Comment 16 [:Cww] 2009-03-20 12:03:15 PDT
(In reply to comment #15)
This bug has been "fixed" in the development version of Firefox only.  Unless you're using a nightly build of Firefox (Gran Paradiso or Shiretoko or Minefield), this hasn't been "fixed" in your version of Firefox. The fix will be shipped when the next update ships.
Comment 17 Al Billings [:abillings] 2009-03-24 15:07:45 PDT
Can we have one of the corrupted cookies.sqlite for QA to test the fix against or some manual method to reproduce the problem since no unit tests were created? I want to verify this for 1.9.0.8.
Comment 18 Al Billings [:abillings] 2009-03-24 16:45:00 PDT
Verified that the corrupt db is deleted on startup for 1.9.0.8 with Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.8pre) Gecko/2009031904 GranParadiso/3.0.8pre and that it isn't for 1.9.0.7.
Comment 19 Serg Podtynnyi 2009-04-23 08:07:25 PDT
Looks like that 3.0.9 broke something in cookies database, after update had problems with cookies storing, only after manual deleting cookies.sqlite file from profile solved this problem. 

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.9) Gecko/2009040821 Firefox/3.0.9 (.NET CLR 3.5.30729)
Comment 20 Mardeg 2009-04-24 03:22:09 PDT
*** Bug 488644 has been marked as a duplicate of this bug. ***
Comment 21 DD 2009-04-26 05:56:43 PDT
Are you sure it's been fixed? I had this problem for some time but recently it just manifested when I first loaded firefox, but if I closed it down and reloaded, it was fine and remembered the login pages correctly. 

However I've just upgraded to 3.0.9 and now it's constantly "forgetting" the login in cookies to several websites. (It remembers some but not others, and it's always the same ones...)

(Windows Vista home premium, AVG 8.0.238, firefox 3.0.9)
Comment 22 Al Billings [:abillings] 2009-04-26 10:09:11 PDT
DD, the problem you are describing is not the same issue as this bug.
Comment 23 Mardeg 2009-04-26 13:07:09 PDT
DD, from http://forums.mozillazine.org/viewtopic.php?p=6042015#p6042015
"I went in to AVG, clicked on the resident shield icon and unticked the 'scan tracking cookies' box and lo and behold it fixed the problem immediately."
Comment 24 Michael McLagan 2009-04-28 11:30:36 PDT
Something tells me that this "fix" is what rebroke the problem that I'm having with cookies, specifically https://bugzilla.mozilla.org/show_bug.cgi?id=457321.

I updated from 3.0.8 to 3.0.10 and my problem has re-appeared.  Bugzilla won't let me change the status of this bug, so I am hoping that this gets sent to involved parties anyways.
Comment 25 [:Cww] 2009-10-29 09:52:35 PDT
We're still seeing people with cookie loss but less so than before so I'm going to clear the common-issue flag from this one and file a new bug if needed.

Note You need to log in before you can comment on or make changes to this bug.