Closed teeli closed 9 years ago
I assume that this problem arises because files of search index are created and changed by different users, for example by "http-server user" (www-data) and by "user in terminal".
Possible solution: make available to record the storage
folder (or storage/lucene-search
) for all users.
Run the following command to make it:
sudo chmod a+w -R /var/www/html/app/storage
That might be one reason, but all the directories were 777 and files 666. Also it happened while running as root.
I was wondering if it could have something to do with the fact that I have 1 master server, that does the rebuilding, and shares the index over NFS to 6 other load balanced servers. And if it is, do you have any suggestions how to handle multiple servers?
It is a problem arises in case of multiple "non-locking access" to files of search index.
The kernel of search (ZendSearch) used flock()
for "locking access":
// ZendSearch\Lucene\Storage\File\Filesystem.php
class Filesystem extends AbstractFile
{
// ...
public function lock($lockType, $nonBlockingLock = false)
{
if ($nonBlockingLock) {
return flock($this->_fileHandle, $lockType | LOCK_NB);
} else {
return flock($this->_fileHandle, $lockType);
}
}
// ...
}
But flock()
will NOT work on NFS (see page: http://us3.php.net/manual/en/function.flock.php#107939)
There are some solutions:
lock()
in "ZendSearch\Lucene\Storage\File\Filesystem.php". Use this fork in "laravel-lucene-search".
2.Very brute solution. Create own "ZendSearch\Lucene\Storage\File\Filesystem" class with alternate implementation of lock()
which will boot instead of original.Thanks. That would explain it. I'll have to try a workaround for it.
I'm getting a bunch of errors running search:rebuild on Laravel 4.2 and laravel-lucene-search 1.1.3
Any ideas what could be causing this and how to fix it?
and occasianlly this: