Can't delete index file on v8 api create

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?

THere’s something peculiar about XAMPP that breaks SuiteCRM in about 10,000 ways if you don’t turn off display_errors in your php.ini.

So turn it off, in two places

  1. php.ini for web server
  2. php.ini for CLI

then restart web server and try again.

The logging reference for SuiteCRM is:

which is quite comprehensive. However, whilst XAMPP and windows are really annoying with permissions especially, and does create errors, it’s important to get a feel for what messages/errors may be produced, and also it provides a start point for debugging and identifying things that may need patching.

As @pgr has pointed out, you want to turn off display_errors i n any production/demo environment. Also you may wish to consider a linux hosting environment for anything that you are putting into production.

Any insights you gain wrt errors on the XAMPP are worth highlighting as it appears tht it is a fairly common arrangement that people are wanting to use.