ZF-6963: Zend_Search_Lucene::addDocument() fails with invalid file permissions
Description
If I use following construct to create and use an index: $file = "/generated/search/index"; if (!file_exists($file)) { self::$_index = Zend_Search_Lucene::create($file); } else { self::$_index = Zend_Search_Lucene::open($file); }
And a later call to
self::$_index->addDocument($document);
scenario 1 - no index exists
If I delete the index directory, the 'Zend_Search_Lucene::create($file)' gets called and the document appears to get indexed except I get a Fatal error: Exception thrown without a stack frame in Unknown on line 0
Reading documentation I added self::$_index->commit(); after the addDocument() but this doesn't make any difference (i.e. same error).
the index directory and its components (AFAIK) are created.
scenario 2 - index directory exists (after previous call as per scenario 1)
fails with Uncaught 0, code: Message: fopen(/generated/search/index/write.lock.file) [function.fopen]: failed to open stream: Permission denied
I checked file permissions and they are:
--w--wx-wT 1 nobody webdev 732 Jun 9 13:25 _0.cfs --w--wx-wT 1 nobody webdev 0 Jun 9 13:25 optimization.lock.file -rw-rw-rw- 1 nobody webdev 0 Jun 9 13:27 read.lock.file -rw-rw-rw- 1 nobody webdev 20 Jun 9 13:25 segments_1 -rw-rw-rw- 1 nobody webdev 20 Jun 9 13:25 segments.gen --w--wx-wT 1 nobody webdev 0 Jun 9 13:25 write.lock.file
My system details: OS = Red Hat RHEL5 64bit PHP Version 5.2.4 Server Software Apache/2.2.4
I've searched across the issue tracker and the only thing that seems to crop up is that the system is 64bit and there have been some problems in that area. Is this one of them? Are there other checks I can make to try and determine if this is a bug?
Comments
Posted by Gerrit Kamp (gkamp) on 2009-06-29T15:22:50.000+0000
Hi, I have the same problem. Funny thing is that it works fine in one folder with one owner and it does not work in another folder with another owner so it cannot be the OS or the 64bit. Issue is serious for me because one site with paying customers now don't have search... ;-(. Please let me know how I can help to resolve this asap. Cheers, Gerrit
Posted by Gerrit Kamp (gkamp) on 2009-06-29T17:47:50.000+0000
I have some info that may help. As explained, I run the same reindex script from two different user accounts. First one: /home/user1/public_html/var/search_index/ Start with emtpy var/search_index folder. Run 'reindex' script. Creates: 1 segments_xx file set of .cfs files optimization.lock.file (0 bytes) read.lock.file (0 b) write.lock.file (0 b) segments.gen (20 b) set of .sti files
Owner of all files is user_1, owner of the folders in which the script is run. File rights in var/search_index/ are all 0666. Folder rights are 0755.
Precisely script for user_2, same script, same data. Start with empty var/search_index folder. Run 'reindex' script. Creates: 1 segments_1 file read.lock.file (0b) write.lock.file (0b) segments.gen (20b)
Nothing more, no error stack, script hangs (white screen).
Owner of all files and folders is user_2
Now, I create the full index on a local machine and then copy it to the var/search_index folder for user_2, as user_2. Then, of course, the search works. But still cannot reindex. Chown 666 (was 664) Run 'reindex' script. An extra segments_xy file is added, size 20b, the older segments_xx file is not removed. Index is not updated. Run 'reindex' script again: an extra segments_xz file is added, size 20b, the older segment_xx and xy files are not removed. Index not updated.
Posted by Gerrit Kamp (gkamp) on 2009-07-05T11:35:16.000+0000
Hi guys, You can ignore my comments, I have solved it for me. Turns out that one of the classes of the Zend Framework was not copied to my 2nd instance which caused the error. Had nothing to do with the permissions.