Open piotr-cz opened 8 years ago
Hey i just tried it with a very simple SQLite script and had no problems. Can you provide me with a test case?
<?php
$connection = new PDO('sqlite:test.sqlite');
$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
try {
$connection->exec(
"CREATE TABLE IF NOT EXISTS testTable
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
column VARCHAR(225),
document text
)
");
} catch (PDOException $e) {
die($e->getMessage());
}
die('SQLite Database created');
This should print message SQLite Database created
, but without _locallock=posix prints SQLSTATE[HY000]: General error: 10 disk I/O error
.
Does not matter if the sqlite-test.sqlite file has been created before or not.
My vagrant box is homestead v2.2.1
That works with a default ubuntu box. I'll have to try with homestead...
Ok got the same error in homestead with the default mount options. Just using rw,vers=3,udp,nolock
works. Will take a look when i get some time.
Any news on this? I ran into the same issue while using Behat on my homestead install using sqlite.
Hey,
the problem is that winnfsd does not nlm (file locking) and i probably won't implement this any time soon.
If the share is mounted with the nolock
option, it works without problems. This is the default behaviour with a normal vagrant config.
Laravel homestead does not do this by default, but you can force it to:
In homestead/scripts/homestead.rb replace the following:
if settings.include? 'folders'
settings["folders"].each do |folder|
mount_opts = []
if (folder["type"] == "nfs")
mount_opts = folder["mount_opts"] ? folder["mount_opts"] : ['actimeo=1']
end
config.vm.synced_folder folder["map"], folder["to"], type: folder["type"] ||= nil, mount_options: mount_opts
end
end
with this:
if settings.include? 'folders'
settings["folders"].sort! { |a,b| a["map"].length <=> b["map"].length }
settings["folders"].each do |folder|
config.vm.synced_folder folder["map"], folder["to"],
id: folder["map"],
:nfs => true,
:mount_options => ['nolock,vers=3,udp']
end
end
When using this plugin, I'm getting an SQLite error
SQLSTATE[HY000]: General error: 10 disk I/O error
after ~20s timeout when using php'sPDO::query
method.There is not much info about the issue out there, just notes on PHP.net sqlite-open and SQLite FAQ sites suggesting not to use SQLite in combination with NFS at all.
I was able to make it work by setting
mount_opts: [local_lock=posix]
, but it slowed the systemalmost to the point of when I didn't use vagrant-winnfsd plugin at allconsiderably.If anyone is aware of solution, please let me know. Anyway I believe it's worth to have a reference for other users to save some debug time.
Vagrant: 1.8.5 vagrant-winnfsd: 1.3.0 WinNFSd 2.2.0 PHP 5.6.14