conan: [bug] conan install sometimes fails offline, despite all recipes/packages in cache

Environment details

  • Operating System+version: Ubuntu 22.04 x86_64
  • Compiler+version: g++11
  • Conan version: 2.0.15
  • Python version: 3.10

We are using a private artifactory instance as our conan remote, with conan-center removed from the remotes list.

Steps to reproduce

Reproduction: I’m still not sure how to reproduce this. Sometimes it happens, and sometimes it doesn’t.

The only step I take on my end that causes it to occur is to disconnect my machine from the internet.

Notes:

  • All recipes and binaries are definitely in my local cache (due to earlier builds succeeding while online)
  • “–update” is not passed as an arg to conan install, so it shouldn’t be reaching out to any remotes
  • Passing -nr while offline (and while this error is occurring) allows for a successful build, also proving the recipes/package binaries are available
  • The project build does succeed when -nr is passed.
  • My conan install invocation (with -vvv passed in) is contained within the logs attached.
  • The is one log for invoking with -nr and one without (and contains the error output)

Logs

install_log_with_nr.txt install_log_without_nr.txt

Related slack thread: https://cpplang.slack.com/archives/C41CWV9HA/p1703140106967259

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 28 (13 by maintainers)

Most upvoted comments

I am experimenting in https://github.com/conan-io/conan/pull/15516 the possibility of the behavior that you suggest above, and considering the possible risks. Not guaranteed to move forward, just trying at this moment

An explanation of the above withstanding, for our user experience, I think I would prefer to not have situations where tool_requires() package builds/downloads are ever skipped and are always ensured to be present in the host’s cache, if only to avoid this specific offline build error.

In any case, the intended and designed Conan logic is that “offline remotes” must be managed explicitly, not implicitly, and -nr is a convenience to avoid temporary disabling of remotes by users, not as a general strategy. If at some point some remotes are offline, the recommended approach is to explicitly inform Conan with conan remote disable. Otherwise remotes are expected to be available and connected, and not being able to reach them is considered an error, not skipped.