Closed mnocon closed 2 years ago
Hi!
I believe there's an issue in this bundle that can occur when the Controller:indexAction is invoked for the first time.
Controller:indexAction
We have a test suite with browser tests that runs in parallel and from time to time we see failures like this in the logs:
request.CRITICAL: Uncaught PHP Exception ErrorException: "Warning: mkdir(): File exists" at /var/www/vendor/friendsofsymfony/jsrouting-bundle/Extractor/ExposedRoutesExtractor.php line 179 {"exception":"[object] (ErrorException(code: 0): Warning: mkdir(): File exists at /var/www/vendor/friendsofsymfony/jsrouting-bundle/Extractor/ExposedRoutesExtractor.php:179)"} []
There's a race condition in the code which can lead to this error - my suggestion is to make it a bit more bullet-proof.
The other mkdir usage in this package is already "hardened": https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/blob/089c7380eaaacf776f99c6fbf51f787d395b2013/Command/DumpCommand.php#L126-L131
mkdir
and I've based my solution on that.
Thanks @mnocon
Hi!
I believe there's an issue in this bundle that can occur when the
Controller:indexAction
is invoked for the first time.We have a test suite with browser tests that runs in parallel and from time to time we see failures like this in the logs:
There's a race condition in the code which can lead to this error - my suggestion is to make it a bit more bullet-proof.
The other
mkdir
usage in this package is already "hardened": https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/blob/089c7380eaaacf776f99c6fbf51f787d395b2013/Command/DumpCommand.php#L126-L131and I've based my solution on that.