Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLiteJournal not working in VM's shared folder #37

Closed
fmasa opened this issue Dec 25, 2015 · 9 comments
Closed

SQLiteJournal not working in VM's shared folder #37

fmasa opened this issue Dec 25, 2015 · 9 comments

Comments

@fmasa
Copy link

fmasa commented Dec 25, 2015

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;

in SQLiteJournal.php:36

image

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

@milo
Copy link
Member

milo commented Dec 25, 2015

Which OS do you run in VirtualBox and which file system is used for /var mount?

@fmasa
Copy link
Author

fmasa commented Dec 25, 2015

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

@fmasa
Copy link
Author

fmasa commented Jan 12, 2016

ping @milo
Any news?

@milo
Copy link
Member

milo commented Jan 12, 2016

I tried that quicky but I didn't reproduced it and I forgot. I'll let you know...

@fmasa
Copy link
Author

fmasa commented Jan 19, 2016

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}

@Majkl578
Copy link
Contributor

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.

@fmasa
Copy link
Author

fmasa commented Jan 20, 2016

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 file

Anyhow 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-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.


Reply to this email directly or view it on GitHub
#37 (comment).

@milo
Copy link
Member

milo commented Jan 20, 2016

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.

@fmasa
Copy link
Author

fmasa commented Feb 23, 2016

@milo You're right. This can be closed. "Workaround" exists using smb instead of vboxsf.

Thanks

@dg dg closed this as completed Feb 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants