flint / Lurker

Resource Tracking
http://lurker.rtfd.org
MIT License
179 stars 24 forks source link

SplFileInfo::getMTime(): stat failed #13

Open burzum opened 9 years ago

burzum commented 9 years ago

I'm using Robo and it's file watcher, which uses your lib to track the changes. Sometimes, in random cases, when the file was changed this error comes up:

SplFileInfo::getMTime(): stat failed
\src\Lurker\Resource\DirectoryResource.php:30

I've seen that Symfonys caching suffered from a similar issue, I'm not sure if this will help here as well but maybe it can help fixing the issue. See https://github.com/symfony/symfony/commit/c6e9e06abbd707131fc95f68d9c1e2a7c9c6912e

However, I can't reproduce it as it seems to happen randomly and not very often. I'm using php 5.6 and 5.5 and it happens with both versions. I'm running it on Windows 8. But I've seen that it seems like you're already checking if the file exists.

My guess is that phpstorm, which is sometimes terrible slow, still accesses the file while the change was already detected by the script but phpstorm didn't unlock it at this time.

So maybe an additional check on the lock might solve the issue? See http://stackoverflow.com/questions/9863118/check-if-a-file-is-already-locked-using-flock