[bitbake-devel] The PR Service deletes the -wal and -shm sqlite files when daemonizing

Diego Santa Cruz Diego.SantaCruz at spinetix.com
Tue Feb 2 14:30:09 UTC 2016


Hi there,

As reported in bug #9034 [1] there is an issue in the daeamon mode of the PR Service where the -wal and -shm sqlite files are deleted as soon as it daemonizes, leading to problems as described in the bug.

The description I entered in the bug report is the following (with some typos removed...). The attached patch solves this problem for me.

When daemonizing the PR service the -wal and -shm sqlite files are being deleted, although they should never be (see https://www.sqlite.org/wal.html and https://www.sqlite.org/tempfiles.html).

While the daemonized process keeps the file descriptors open (seen from /prid<pid>/fd on linux) and thus a clean exit does not lose any data, a power outage would lose all data in the WAL as the -wal file is unavailable when sqlite does its recovery, so even committed transactions would be lost.

Removing these files also breaks sqlite collaboration between processes and furthermore prevents taking proper backups without stopping the PR service (e.g., with sqlite3 shell's ".backup" command).

The reason the files are deleted is that the DB connection is opened in the initial process, before forking for daemonization. When the DB connection is closed by the exiting parent processes it can delete the -wal and -shm files if it considers itself to be the last connection to the DB. This is easily fixed by opening the DB connection after all forking.

The attached patch does this (on top of jethro branch). With this I have been able to start the PR Service in daemon mode and the -wal and -shm files do exist and I can take proper backups.

Best regards,

Diego

[1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=9034

--
Diego Santa Cruz, PhD
Technology Architect
T +41 21 341 15 50
diego.santacruz at spinetix.com
spinetix.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20160202/f851cabc/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-bitbake-prserv-wal-and-shm-sqlite-lost-when-daemoniz.patch
Type: application/octet-stream
Size: 2650 bytes
Desc: 0001-bitbake-prserv-wal-and-shm-sqlite-lost-when-daemoniz.patch
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20160202/f851cabc/attachment-0002.obj>


More information about the bitbake-devel mailing list