Skip to content
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] Workspaces AssertionError #6117

Closed
spoofedex opened this issue Nov 22, 2019 · 4 comments
Closed

[bug] Workspaces AssertionError #6117

spoofedex opened this issue Nov 22, 2019 · 4 comments
Assignees

Comments

@spoofedex
Copy link

spoofedex commented Nov 22, 2019

Environment Details (include every applicable attribute)

  • Operating System+version: Windows 7
  • Compiler+version: Visual Studio 14
  • Conan version: 1.20.2
  • Python version: 3.7.3

Description

I've been receiving an issue when trying to install a workspace. The error is as follows:

abc/1.0.0@user/stable: Updated ID: Package_ID_unknown
Traceback (most recent call last):
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\conans\client\command.py", line 1938, in run
    method(args[0][1:])
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\conans\client\command.py", line 1704, in workspace
    install_folder=args.install_folder)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\conans\client\conan_api.py", line 81, in wrapper
    return f(api, *args, **kwargs)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\conans\client\conan_api.py", line 480, in workspace_install
    graph_info=graph_info)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\conans\client\installer.py", line 308, in install
    self._build(nodes_by_level, keep_build, root_node, graph_info, remotes, build_mode, update)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\conans\client\installer.py", line 331, in _build
    self._binaries_analyzer.reevaluate_node(node, remotes, build_mode, update)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\conans\client\graph\graph_binaries.py", line 323, in reevaluate_node
    assert node.package_id != PACKAGE_ID_UNKNOWN
AssertionError

My yml file looks as follows:

editables:
    a/2.1.0@user/stable:
        path: a
    b/1.0.0@user/stable:
        path: b
layout: layout_vs
generators: cmake_multi
workspace_generator: cmake
root: b/1.0.0@user/stable

Where "b" has a dependency on "a" and "abc" (from the stack trace), and both "abc" has a dependency on "a".

I have configured default_package_id_mode=full_package_mode.

Within all packages' package_id I call:
self.info.requires.package_revision_mode()
If I remove this call, it does work.

Unfortunately, I don't have sufficient time to make a smaller reproduction. But I did do some analysis, so I hope that is sufficient to figure out what's going on. I will try to make a reproduction if I have time later.

Analysis

The reason that the node's package_id is PACKAGE_ID_UNKNOWN, is that the RequirementInfo's sha property returns None for package a, because self.package_revision == PREV_UNKNOWN is true. This is caused by the Node's prev never being set.

For all dependencies except for "a" and "b", the node's prev is set at _evaluate_cache_pkg (node.prev = metadata.packages[pref.id].revision).

This method is called from _process_node, which is called for all dependencies, including a and b. However, the call to _evaluate_cache_pkg is never reached, because it returns sooner. It hits the following return:

        if node.recipe == RECIPE_EDITABLE:
            node.binary = BINARY_EDITABLE  # TODO: PREV?
            return

So indeed, it seems like I'm running into the "TODO" case.

@spoofedex
Copy link
Author

I've managed to make a reproduction whose error is slightly different, but I believe is caused by the same issue.
In the configuration, set default_package_id_mode=full_package_mode.

Given the files:
aa/conanfile.py:

from conans import ConanFile

class AaConan(ConanFile):
    name = "aa"
    version = "1.0.0"
    settings = "os", "compiler", "arch", "build_type"

bb/conanfile.py:

from conans import ConanFile

class BbConan(ConanFile):
    name = "bb"
    version = "1.0.0"
    settings = "os", "compiler", "arch", "build_type"
    requires = "aa/1.0.0@user/stable"

    def package_id(self):
        self.info.requires.package_revision_mode()

layout_vs:

[build_folder]
../build/{{reference.name}}

[includedirs]
include

[source_folder]
.

[libdirs]
../build/{{reference.name}}

test.yml:

editables:
    aa/1.0.0@user/stable:
        path: aa
    bb/1.0.0@user/stable:
        path: bb
layout: layout_vs
generators: cmake_multi
workspace_generator: cmake
root: bb/1.0.0@user/stable

Then after the following commands:

cd aa && conan create . user/stable && cd ..
cd bb && conan create . user/stable && cd ..
mkdir tmp && cd tmp && conan workspace install ../test.yml

Outputs the following:

Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=14
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

Requirements
    aa/1.0.0@user/stable from user folder - Editable
    bb/1.0.0@user/stable from user folder - Editable
Packages
    aa/1.0.0@user/stable:63da998e3642b50bee33f4449826b2d623661505 - Editable
    bb/1.0.0@user/stable:Package_ID_unknown - Unknown

aa/1.0.0@user/stable: Generator txt created conanbuildinfo.txt
aa/1.0.0@user/stable: Generator cmake_multi created conanbuildinfo_release.cmake

aa/1.0.0@user/stable: Generator cmake_multi created conanbuildinfo_multi.cmake
aa/1.0.0@user/stable: Generated conaninfo.txt
aa/1.0.0@user/stable: Generated graphinfo
aa/1.0.0@user/stable: Generated conanbuildinfo.txt
Traceback (most recent call last):
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\conans\client\command.py", line 1938, in run
    method(args[0][1:])
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\conans\client\command.py", line 1704, in workspace
    install_folder=args.install_folder)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\conans\client\conan_api.py", line 81, in wrapper
    return f(api, *args, **kwargs)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\conans\client\conan_api.py", line 480, in workspace_install
    graph_info=graph_info)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\conans\client\installer.py", line 308, in install
    self._build(nodes_by_level, keep_build, root_node, graph_info, remotes, build_mode, update)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\conans\client\installer.py", line 328, in _build
    assert ref.revision is not None, "Installer should receive RREV always"
AssertionError: Installer should receive RREV always

ERROR: Installer should receive RREV always

@jgsogo jgsogo self-assigned this Nov 27, 2019
@jgsogo
Copy link
Contributor

jgsogo commented Nov 27, 2019

Hi, @spoofedex

As you have said, the problem is related with the package_id_mode you are using. With package_revision_mode the package_ID of a consumer will take into account everything from its dependencies, also the package revision which is the hash of the actual binaries. (Have a look to this blogpost for more information about package IDs).

So, Conan cannot compute the package_ID of the consumer until all the binaries of all the requirements are available. This is somehow impossible with an editable package (workspace), as the binaries will be changing continuously.

We know that workspaces have several open issues, we know we need to invest a lot of time on them (maybe rewrite lots of code), but possible yours is an edge case an Conan won't be prepared to handle it: the only way would be to ignore the package_ID of the consumers (it cannot be computed) but it is against one of the fundamental rules of Conan (package_IDs are key for Conan to work properly).

I'm sorry, but it looks like this issue will have to wait after other important ones also related to workspaces.


Anyway, I wonder why do you need to use package_revision_mode to work with your workspace. IMHO, as I said before, I think it is something "incompatible".

Thanks!

@evandrocoan
Copy link

I also got this error: ERROR: Installer should receive RREV always, I fixed it by deleting my ~/.conan directory. I think it was because I had canceled my conan build once with Ctrl+C.

@memsharded
Copy link
Member

Workspaces were removed in 2.0, but the plan is to resume work on them in the 2.X roadmap.
Please track progress in #12466, closing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants