-
Notifications
You must be signed in to change notification settings - Fork 991
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
[bug] concurrency errors in conan export #11480
Comments
This is not a bug, this is per-design. We will eventually work on concurrency after 2.0, but at the moment this is not a bug. |
Conan 1.X never promised nor documented to be concurrency-safe, so in that sense it cannot be a regression. Here you can find the summary for 2.0 that indicates the cache is not concurrent: conan-io/docs#2593 |
I faced with the same problem on "conan install". Is it not a bug too? |
12:53:49.043 ======== Computing dependency graph ========
12:53:49.043 cprocsp/5.0.11732@rutoken/experimental: Not found in local cache, looking in remotes...
12:53:49.043 cprocsp/5.0.11732@rutoken/experimental: Checking remote: conancenter
12:53:49.043 cprocsp/5.0.11732@rutoken/experimental: Checking remote: rutoken
12:53:49.043 ERROR: [Errno 17] File exists: '/home/jenkins/.conan2/p/cprocb60939207fe33/e' |
Yes, at the moment cache is not concurrent: https://docs.conan.io/2/knowledge/guidelines.html There could be some tricks that would allow some concurrency, for example, if the
|
It seems better to use self-written wrapper for me. Something like that: #!/bin/env bash
LOCKFILE=~/rutoken_conan.lock
(
flock 9 || exit 1
conan $@
) 9>${LOCKFILE} Our CI may build different project with the same profile at the same time |
Sure, with the wrapper you probably won't hit any issues at all, because you are doing strictly sequential usage of the cache, isn't it? |
The problem is that machines at our CI may build several projects with the same profile at the same time. And it's hardly to avoid this. So, to avoid concurrent I have to disable cache at all (make it local) or use global lock file. Btw, I'm working on another solution, based on custom commands: from conan.cli.command import conan_command
from conan.cli.commands.install import install, json_install
from conans.util.locks import SimpleLock
from os import path
@conan_command(group="Custom commands", formatters={"json": json_install})
def rtinstall(conan_api, parser, *args):
"""
Concurrency-safe wrapper over install cmd.
"""
with SimpleLock(path.join(conan_api.cache_folder, "global.lock")):
return install.run(conan_api, parser, *args) |
Thanks for the feedback, seems a reasonable approach I like the idea of a global lock over a cache, that would be quite safe, and avoid difficult to debug race conditions. |
Got you. Each case of usage should have own most efficient approach) Btw. |
It is very possible that the moment we start to address the cache concurrency, these objects might suffer modifications. Not be removed, but likely to have breaking changes, even renames. So in the general case not recommended for usage. In any case that is a relatively thin layer over |
I noticed that from conan.cli.command import conan_command
from conan.cli.commands.install import install, json_install
from conans.util.locks import SimpleLock
from os import path
@conan_command(group="Custom commands", formatters={"json": json_install})
def rtinstall(conan_api, parser, *args):
"""
Concurrency-safe wrapper over install cmd.
"""
with SimpleLock(path.join(conan_api.cache_folder, "global.lock")):
return install._method(conan_api, parser, *args) May you suggest another approach how to rightly wrap conan commands? |
Oh, yes, the commands are not designed to be directly called from other commands, that is what could be causing that |
@memsharded Hello! This feature still not implemented? |
This has already improved in #15630, it will be in next 2.2 release. It allows to call other commands from any other command via a new The cache concurrency, still not there. It is a challenging feature that will require time, and we still have many other higher priority issues. |
Closing in favor of #15840 where the Conan 2 cache concurrency future progress will be reported. |
Environment Details (include every applicable attribute)
macOS 12.3
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Conan version 2.0.0-alpha7
Python 3.7.1
Steps to reproduce (Include if Applicable)
launch a simple script:
Logs (Executed commands with output) (Include/Attach if Applicable)
observe various random errors:
The text was updated successfully, but these errors were encountered: