cookies.sqlite-shm & cookies.sqlite-wal?

Discussion of general topics about Mozilla Firefox
Post Reply
Anonymosity
Posts: 8779
Joined: May 7th, 2007, 12:07 pm

cookies.sqlite-shm & cookies.sqlite-wal?

Post by Anonymosity »

While Firefox 6 is running, there are two extra cookies files in the profile: cookies.sqlite-shm and cookies.sqlite-wal. These disappear when Firefox closes. What do they do?
KWierso
Posts: 8829
Joined: May 7th, 2006, 10:29 pm
Location: California

Re: cookies.sqlite-shm & cookies.sqlite-wal?

Post by KWierso »

They are used in-session only to help with handling the cookies.sqlite database file, I think.
User avatar
Bluefang
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont
Contact:

Re: cookies.sqlite-shm & cookies.sqlite-wal?

Post by Bluefang »

It's a database journal. They have a similar function and use to filesystem journals.

http://en.wikipedia.org/wiki/Journaling_file_system
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...
Anonymosity
Posts: 8779
Joined: May 7th, 2007, 12:07 pm

Re: cookies.sqlite-shm & cookies.sqlite-wal?

Post by Anonymosity »

OK. Thanks.
User avatar
Grumpus
Posts: 13239
Joined: October 19th, 2007, 4:23 am
Location: ... Da' Swamp

Re: cookies.sqlite-shm & cookies.sqlite-wal?

Post by Grumpus »

This should explain the sqlite-wal part of it a little.
Write ahead logging
Doesn't matter what you say, it's wrong for a toaster to walk around the house and talk to you
vasa1
Posts: 604
Joined: December 24th, 2010, 5:32 am

Re: cookies.sqlite-shm & cookies.sqlite-wal?

Post by vasa1 »

I had made a post some time ago regarding the files present in a typical profile. But ...
User avatar
Grumpus
Posts: 13239
Joined: October 19th, 2007, 4:23 am
Location: ... Da' Swamp

Re: cookies.sqlite-shm & cookies.sqlite-wal?

Post by Grumpus »

@Vasa1 - you are right we've had this discussion before with little resolution.

So far I've found no ill effects erasing these files, frankly I don't really like the whole sqlite concept.
I disliked it with earlier version of FF where it created a sqlite-journal, which it still seems to do for cookies, places, extensions or other files.
It's as if something is editing files or accumulations which I would rather not have edited in preparation for addition. The cookies adjunct files are especially troubling since I am not accepting cookies, so why are these files being created?
Not accepting cookies means nothing is added, so why write ahead or management of something not supposedly open to change?
It's not something which is created at all sites on the Internet, it seems to be affected by something at particular sites.
Doesn't matter what you say, it's wrong for a toaster to walk around the house and talk to you
User avatar
Bluefang
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont
Contact:

Re: cookies.sqlite-shm & cookies.sqlite-wal?

Post by Bluefang »

Since the places.sqlite and cookies.sqlite are typically high-IO databases, it's probably set-up to automatically create the journal files when the database is opened. And they are opened in the start-up/page-load process.

To test, I created a new profile, opened Firefox and set it to not accept cookies, then quit. I then restarted it by opening about:blank from the command line. Sure enough, the shm/wal files were created for places.sqlite and cookies.sqlite once I visited a site. However, no data was written to any of the coolies.* files.

And these files should automatically be cleaned up after closing Firefox. If they aren't, deleting them could potentially delete information that hasn't actually been written to the database. And given that these are very small files, I see no benefit in deleting them.
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...
User avatar
Grumpus
Posts: 13239
Joined: October 19th, 2007, 4:23 am
Location: ... Da' Swamp

Re: cookies.sqlite-shm & cookies.sqlite-wal?

Post by Grumpus »

I considered there may have been some form of writing going on to these files and holding the changes noted until such time they could be added or managed for places or cookies, same for the one created for extensions.
With tracking off, all downloads set to manual, automatic updates off and cookies off there should be no record of changes unless it was an unrequested transfer of some form. Deleting them may be something to consider.
Sizes are not so small.
Looking at cookies.sqlite-shm = 32Kb and wal at 96.1Kb ; places.sqlite-shm = 32Kb but the wal = 571Kb. Thats a pretty good size file for changes in a database where no changes are supposed to be occurring unless this is relative to some other condition like icon changes for bookmarks or something else. If someone can write to these short files and then they are automatically transferred into the places or cookie database this could lead to abuse through tracking or site manipulation/spoofing but in the actual bookmark file.
I am probably off base with the tin foil approach on this but anytime something is automatically writing to the system it needs to be clarified more. Purpose and level of importance need be detailed a bit.
Doesn't matter what you say, it's wrong for a toaster to walk around the house and talk to you
User avatar
Grumpus
Posts: 13239
Joined: October 19th, 2007, 4:23 am
Location: ... Da' Swamp

Re: cookies.sqlite-shm & cookies.sqlite-wal?

Post by Grumpus »

This morning I tried BlueFang's experiment and places.sqlite-shm and places.sqlite-wal files are created when opening about:blank and do leave the file tree when Firefox is closed. There is no indication of file size change after the close to other visible files but because the opened page is about:blank there is a zero value in the wal file while the shm maintains what appears to be a repeated 32Kb.
Doesn't matter what you say, it's wrong for a toaster to walk around the house and talk to you
User avatar
Bluefang
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont
Contact:

Re: cookies.sqlite-shm & cookies.sqlite-wal?

Post by Bluefang »

The link you posted already explained what the SHM file was. It's a mmapped file backing shared memory. It's used to allow multiple simultaneous connections to the database.
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...
Post Reply