While calling API v8 to create records - leads or calls, sometimes getting this error:
Fatal error: Uncaught Zend_Search_Lucene_Exception: Can't delete file: unlink(modules/AOD_Index/Index/Index/_18.fdx): Resource temporarily unavailable in C:\Dropbox\suite_7_11_15\vendor\zf1\zend-search-lucene\library\Zend\Search\Lucene\Storage\Directory\Filesystem.php:216 Stack trace: #0 C:\Dropbox\suite_7_11_15\vendor\zf1\zend-search-lucene\library\Zend\Search\Lucene\Index\SegmentWriter.php(622): Zend_Search_Lucene_Storage_Directory_Filesystem->deleteFile('_18.fdx') #1 C:\Dropbox\suite_7_11_15\vendor\zf1\zend-search-lucene\library\Zend\Search\Lucene\Index\SegmentWriter\DocumentWriter.php(215): Zend_Search_Lucene_Index_SegmentWriter->_generateCFS() #2 C:\Dropbox\suite_7_11_15\vendor\zf1\zend-search-lucene\library\Zend\Search\Lucene\Index\Writer.php(757): Zend_Search_Lucene_Index_SegmentWriter_DocumentWriter->close() #3 C:\Dropbox\suite_7_11_15\vendor\zf1\zend-search-lucene\library\Zend\Search\Lucene.php(1436): Zend_Search_Lucene_Index_Writer->commit() #4 C:\Dropbox\suite_7_11_15\vendor\zf1\zend-search-lucene\library\Zend\ in C:\Dropbox\suite_7_11_15\vendor\zf1\zend-search-lucene\library\Zend\Search\Lucene\Storage\Directory\Filesystem.php on line 216
SuiteCRM is running on XAMPP on Windows, version 7.11.15
It is my local development environment to develop API integration.
The file permissions are set properly, but it fails sometimes to delete index file. API calls are successful and sometimes I am getting this error with the response.
The whole problem is that it is coming back in body of the response from API and even the response indicates successful creation of record, it is impossible to parse the response when this error appears.
IMHO this is not the error that should fail the whole process of creating new record through API.
May be to catch it and write it to log will be more useful.
As a patch for now I edited the source code in /vendor/zf1/zend-search-lucene/library/Zend/Search/Lucene/Index/SegmentWriter.php
replaced this row:
$this->_directory->deleteFile($fileName);
with this:
try
{
$this->_directory->deleteFile($fileName);
} catch (Zend_Search_Lucene_Exception $ex) {
}
How can I log from here to suitecrm.log?