-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to take the filesystem lock on .vcpkg-root #12286
Comments
The reason we do this is so that we lock the buildtrees and downloads and such, which are shared globally -- would adding a |
why don't immediately do with the parameter, lock by default, and don't block with the parameter |
@voskrese because that is a disaster waiting to happen -- if you both try to write to buildtrees at the same time, then you're gonna get bad failures. |
Yes, this would solve the issue. Currently we are working around this issue by manually wrapping
Are there any plans to cache built vcpkg packages? (Judging by #12091 it seems so). If there's no caching then |
Cool, then I'll add that feature in #12227 :) |
@strega-nil Since I merged the manifest code, I too have issues with our CI. We use and mix some complex ports and custom toolchain that leads to a reentrant call to |
Hmm... alright, yeah, I think I'll take the lock out for now in non-manifest builds until we can lock cleanly. |
Thanks, although I do have a need for a lock on vcpkg database to prevent multiple install from different process, but I’d rather tell my users to not run multiple CI at the same time than it failing all the time :) Implementing a reentrant file lock might be challenging, as it’s usually not supported by system APIs, but it should be doable. |
@christophe-calmejane I'm not concerned about it right now, because I'm keeping the file lock for users of the new manifest mode; this means that existing users will not be broken, while new users using the new mode will write their code as if the file lock exists (and hopefully we won't need reentrant locks) |
From googleapis/google-cloud-cpp#4487:
It looks like the file locking APIs we use are unavailable in a mapped docker volume. This looks like a straightforward case of "we should offer an environment variable to not take the lock". Users in docker can pass |
Edit: Reading comprehension issue on my part :)
In this case, it would be best to avoid the call to vcpkg and instead just look for the files in the installed directory. This should be as simple as passing something like Below is my original post @christophe-calmejane JFYI, reentrant calls to
Ideally, the install could be listed as a dependency, but I assume you're doing this because of a cross-compilation scenario? |
@ras0219-msft Well, it's not that simple as I'm mixing multiple build systems together :) |
Fixes microsoft#12190 Fixes microsoft#12208 Fixes microsoft#12234 Fixes microsoft#12286 Fixes microsoft#12315 Fixes microsoft#12186 Fixes microsoft#12331 Fixes googleapis/google-cloud-cpp#4487
Our CI relies on a global vcpkg installation for each platform. Build jobs happen in unique directories where we run
vcpkg install
to deal with any necessary dependencies. After the merging of #11757 we started using manifest files, which worked perfectly (thanks @strega-nil!).Describe the bug
The manifest PR (#11757) added a filesystem lock (.vcpkg-root) which multiple build scripts might try to acquire simultaneously. The current timeout of 1.5-ish seconds is not enough since the lock seems acquired until the
vcpkg install
command finishes. See:vcpkg/toolsrc/src/vcpkg/base/files.cpp
Lines 932 to 943 in a28bfe7
Calling
vcpkg install
in directories with manifest files shouldn't modify the global%VCPKG_ROOT%/installed
folder (afaik!), but place everything in./vcpkg_installed
instead. Thus, it seems unnecessary to lock vcpkg globally for minutes at a time.Environment
To reproduce
Steps to reproduce the behavior:
./vcpkg install
in different repositories.Expected behavior
I think there's two possible solutions to this problem (or even a combination of both):
--lock-timeout <seconds>
(or similar) argument for any vcpkg command that might try to take the lock, so that multiplevcpkg install
invocations could execute in series for a sufficiently high timeout.%VCPKG_ROOT%
. When installing dependencies from vcpkg.json manifest files, everything will be written tovcpkg_installed
folder, so there's no need to lock vcpkg globally while that happens.The text was updated successfully, but these errors were encountered: