JMSSerializerBundle icon indicating copy to clipboard operation
JMSSerializerBundle copied to clipboard

Error while unlink cache file

Open petrixs opened this issue 7 years ago • 2 comments

'message': 'Warning: unlink(/var/www/verivication/testing/var/cache/dev/jms_serializer/Doctrine-Common-Collections-AbstractLazyCollection.cache.php): No such file or directory', 'class': 'ErrorException', 'trace': [{'namespace': '', 'short_class': '', 'class': '', 'type': '', 'function': '', 'file': '/var/www/verivication/testing/vendor/jms/metadata/src/Metadata/Cache/FileCache.php', 'line': 80,

I think the problem in concurrent requests: /** * {@inheritDoc} */ public function evictClassMetadataFromCache(\ReflectionClass $class) { $path = $this->dir.'/'.strtr($class->name, '\\', '-').'.cache.php'; if (file_exists($path)) { unlink($path); } } }

When first thread unlinks file, second will throw an error.

petrixs avatar Jul 11 '18 08:07 petrixs

it looks we need something as https://github.com/schmittjoh/serializer/blob/a07ee590f64a4c8b156acc95b0cc33fa63a688b7/src/SerializerBuilder.php#L529 even there. PR are welcome.

goetas avatar Jul 11 '18 09:07 goetas

The issue is in https://github.com/schmittjoh/metadata

goetas avatar Jul 11 '18 09:07 goetas