SQLiteJournal not working in VM's shared folder
fmasa opened this issue · 9 comments
Newly added optimizations of SQLiteJournal caused problem for using SQLiteJournal for apps running in virtual machine (tested in Virtualbox). WAL option doesn't work with network filesystem which is used in Virtualbox.
cause:
PRAGMA journal_mode = WAL;
Way to switch WAL on/off in journal or removal of the line would fix the problem.
Environment:
Windows 10 x64
Container running in Docker Toolbox v1.9.1f
PHP 5.6.16
Which OS do you run in VirtualBox and which file system is used for /var mount?
I'm running Boot2Docker 1.9.1 in Virtualbox. /var is mounted as ext4.
But actual folder mapping is this:
C:\Users in Windows → c/Users in Boot2Docker (vboxsf)
Then /c/Users/User/Project → /var/www/html (vboxsf) in Debian "Jessie" container
I tried that quicky but I didn't reproduced it and I forgot. I'll let you know...
I prepared minimal example (php:5.6-apache image + nette/caching + Tracy debugger):
nette-caching-test.zip
Just run these commands in zipped directory:
composer install && docker-compose up
And then check this URL:
http://{your-vm-ip}
This is interesting.
Just tried your example, all I get is:
PDOException #14
SQLSTATE[HY000] [14] unable to open database file
Anyhow it seems to be some sort of permission issue...
If you put this into your script:
var_dump(getmyuid());
var_dump(decoct(fileperms(__DIR__)));
var_dump(is_writable(__DIR__));
and run it like this:
$ docker run --rm -it -p 39999:80 -v `pwd`:/var/www/html php:5.6-apache
you should get:
int(1000)
string(5) "40755"
bool(false)
It looks like PHP runs under uid 1000 which does not exist inside the container -- wtf...
Note that pwd
above is locally owned by my user account (uid 1000) with 0755 mode on the directory.
If I change the mode to 0777 (on native folder, not inside container), it seems to work.
Tested with Linux + Docker 1.9.1.
Permissions on Linux behave bit different. Windows folder mounted into VM
has 777 permissions.
As I wrote issue is probably VM related. On Linux, there is no VM with
boot2docker.
On Wed, Jan 20, 2016, 01:48 Michael Moravec notifications@github.com
wrote:
This is interesting.
Just tried your example, all I get is:PDOException #14 #14
SQLSTATE[HY000] [14] unable to open database fileAnyhow it seems to be some sort of permission issue...
If you put this into your script:
var_dump(getmyuid());
var_dump(chmod(DIR));
var_dump(is_writable(DIR));and run it like this:
$ docker run --rm -it -p 39999:80 -v
pwd
:/var/www/html php:5.6-apacheyou should get:
int(1000)
string(5) "40755"
bool(false)It looks like PHP runs under uid 1000 which does not exist inside the
container -- wtf...
Note that pwd above is locally owned by my user account (uid 1000) with
0755 mode on the directory.
If I change the mode to 0777 (on native folder, not inside container), it
seems to work.Tested with Linux + Docker 1.9.1.
—
Reply to this email directly or view it on GitHub
#37 (comment).
This is the vboxvfs issue.
The SQLite opens test-shm
(descriptor 5 here):
open("/media/sf_VirtualShare/Bug/test-shm", O_RDWR|O_CREAT|O_CLOEXEC, 0770) = 5
And fails when trying to mmap:
mmap(NULL, 32768, PROT_READ|PROT_WRITE, MAP_SHARED, 5, 0) = -1 EINVAL (Invalid argument)
You can find more issues on Google by vboxfs mmap
. Imho, SQLite storage is OK. With WAL, it has very nice performance boost. Workaround for this can be store temp inside the VM, e.g. /tmp/journal.sqlite
.