Is the cache safe against race conditions? #11872
Unanswered
gbirke
asked this question in
Q&A / Support
Replies: 1 comment
-
Yes, it can lead to race conditions. Control reading and writing into the cache to prevent those. E.g. CI containers get their copy of the cache when they come up, and after the build finished successfully, the packages that are new are copied back into it.. Additionally isolated builds offer the possibility to cache the vendor folder based on composer..json+composer.lock contents. Using hashes in their archive names, they are normally very stable also because reading/writing to the cache is a single file and only happens once. The composer cache is not affected by that and further supports the network operations. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
On our CI machine we share the composer cache as a bind-mounted volume across different CI containers. I was wondering if this could lead to a race condition where two containers run
composer install
in parallel, one container reads an incomplete or empty cache file while another container is writing it.Beta Was this translation helpful? Give feedback.
All reactions