@mgriego opened this Pull Request on October 20th 2014 Contributor

When performing simultaneous cron core:archive runs for large instances, there is a race condition during the file cleanup phase when one process sees the files of another process just before the other process deletes those files, causing the filemtime() call to fail since the file no longer exists. Also, since the return value from filemtime() is not checked for failure (=== FALSE), it tries to unlink() the file on failure, which also fails. At the least, this is causing unnecessary emailings from the cron process. The failure of filemtime() is harmless, though unlinking on that failure may not be. The filemtime() failure can be safely ignored since this function's only purpose is to clean up old files, and the failure just means the file no longer exists.

@mattab commented on October 21st 2014 Owner

Thanks for the report!

instead of suppressing the warning could you maybe wrap in if( file_exists($path)) to check the file exists?

@mgriego commented on October 21st 2014 Contributor

Yes, but that would still leave a small, albeit smaller than before, race window between when file_exists is called and filemtime is called. I do still think that the !== FALSE check needs to be there regardless just in case there are any other problems with the filemtime call, since that failure ends up allowing unlink() to be called, because FALSE is less than one week ago...

@mattab commented on October 21st 2014 Owner

I do still think that the !== FALSE check needs to be there regardless

+1

@mattab commented on October 21st 2014 Owner

:+1:

This Pull Request was closed on October 21st 2014
Powered by GitHub Issue Mirror