-
Notifications
You must be signed in to change notification settings - Fork 994
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] Conan create gets stuck generating dependency graph #17612
Comments
Hi @radonish Thanks for your question.
Yes, it seems that it might be trapped in an infinite loop, but I don't know enough details.
|
Hello, @memsharded, thanks for your response. I've attached the
It's quite a big dependency tree.
No circular dependencies that I can tell. I would have thought any issues in that department to have popped up when building
I have played with this a bit. Initially both |
Thanks for the feedback. Some questions:
Why the dependencies do this? Once the dependencies are exported to the Cache, the
Do you keep the same profiles for Conan 1 and 2? This variable no longer has any effect in new generators (neither Conan 1 nor Conan 2 with generators CMakeToolchain) I still have no idea where it is getting stuck. |
Thanks, @memsharded
The
So, if appx depends on liba/1.0.0 and libb/1.0.0, it effectively makes appx automagically depend on liba/1.0.0+feature_xyz and libb/1.0.0+feature_xyz if the developer is modifying the code in this monolithic repo on branch feature/xyz.
I have updated all of our profiles for Conan 2 but did start with the state of Conan 1 - so, this is just a carry over. I'll remove
That would be great, thank you. Either option should work but the patch may be easier as I've only used official Conan versions installed via pip - so I'd need some guidance to use your branch directly. Thanks |
Ok, so it is basically reading the branch of the consumer repository to define the version of the requirement, if I understood correctly, it is not that the It would be a good starting point if you could test with the following patch: diff --git a/conans/client/graph/graph_builder.py b/conans/client/graph/graph_builder.py
index 51ac37afa..7c1e17fee 100644
--- a/conans/client/graph/graph_builder.py
+++ b/conans/client/graph/graph_builder.py
@@ -53,17 +53,22 @@ class DepsGraphBuilder(object):
(require, node) = open_requires.popleft()
if require.override:
continue
+ print("Expanding requirement:", require.ref, "from node ", node.ref)
new_node = self._expand_require(require, node, dep_graph, profile_host,
profile_build, graph_lock)
+ print(" The new node is: ", new_node.ref if new_node else None)
if new_node and (not new_node.conanfile.vendor
or new_node.recipe == RECIPE_EDITABLE or
new_node.conanfile.conf.get("tools.graph:vendor",
choices=("build",))):
newr = self._initialize_requires(new_node, dep_graph, graph_lock, profile_build,
profile_host)
+ print(" New requirements: ", [r.ref for r in newr])
open_requires.extendleft((r, new_node) for r in reversed(newr))
self._remove_overrides(dep_graph)
+ print("Checking graph providers")
check_graph_provides(dep_graph)
+ print("Finished checking graph providers")
except GraphError as e:
dep_graph.error = e
dep_graph.resolved_ranges = self._resolver.resolved_ranges And see what is the output |
Thanks for the patch, @memsharded. I've attached a new As a reference point, running |
There is something weird in this log:
Expanding a Just in case, do you have any kind of |
Unfortunately I think that was a case of stdout getting mixed up when redirecting to the log file. I re-generated a new log (attached below) and that expanding
No, I do not have any client/graph/graph.py
For what it's worth, once the process has been running for several minutes and the system is bogged down with Conan's high CPU/memory usage, what appears to take a long time is the |
That is still more surprising 😅 The Also, I am confused, I was expecting some kind of recursive, infinite loop, which means that in 5 minutes, the log would have many thousands of lines. But if I understood correctly, it seems that it is less that 1000 lines, so instead of the dependency loop, we probably need to consider some other hypothesis. It would seem that evaluating each node might have some operations there that take a lot of time, and cause the very heavy resource consumption. I am having a look again to the Adding these might also help: diff --git a/conan/internal/methods.py b/conan/internal/methods.py
index b0dbb47b0..e6cb954cc 100644
--- a/conan/internal/methods.py
+++ b/conan/internal/methods.py
@@ -123,11 +123,16 @@ def run_configure_method(conanfile, down_options, profile_options, ref):
if hasattr(conanfile, "requirements"):
with conanfile_exception_formatter(conanfile, "requirements"):
+ import time
+ t = time.time()
conanfile.requirements()
-
+ print(f"Requirements of {conanfile} took: {time.time() - t:.2f}s")
if hasattr(conanfile, "build_requirements"):
with conanfile_exception_formatter(conanfile, "build_requirements"):
+ import time
+ t = time.time()
conanfile.build_requirements()
+ print(f"Tool Requirements of {conanfile} took: {time.time() - t:.2f}s") |
Thanks, @memsharded You can see in this snippet towards the end of the log that the requirements/build_requirements timings are relatively sane:
Here is the source. Yes, I know it's a bit quirky but for now we have to version the mono repo as if the branch is the version.
And then as a reminder, it is used like this within each package's
I will add timings within |
Not that much, the time of the |
Understood. For reference, that same 5.87s time for So, that begs the question, why would the |
Yes, it is certainly a mistery, maybe it depends also on the git repo size, it might be slower. Maybe it would be useful to trace every (require, node) = open_requires.popleft()
if require.override:
continue
+ print("Expanding requirement:", require.ref, "from node ", node.ref)
+ import time
+ t = time.time()
new_node = self._expand_require(require, node, dep_graph, profile_host,
profile_build, graph_lock)
+ print(" Expanded in ", time.time() - t)
+ print(" The new node is: ", new_node.ref if new_node else None)
if new_node and (not new_node.conanfile.vendor
or new_node.recipe == RECIPE_EDITABLE or
new_node.conanfile.conf.get("tools.graph:vendor",
choices=("build",))):
newr = self._initialize_requires(new_node, dep_graph, graph_lock, profile_build,
profile_host)
+ print(" New requirements: ", [r.ref for r in newr])
open_requires.extendleft((r, new_node) for r in reversed(newr))
self._remove_overrides(dep_graph)
+ print("Checking graph providers")
check_graph_provides(dep_graph)
+ print("Finished checking graph providers")
except GraphError as e:
dep_graph.error = e
dep_graph.resolved_ranges = self._resolver.resolved_ranges And have it run for at least those 5 minutes, to see if there is some pattern we can see in some requirements and not others, or an evolution over time. |
Describe the bug
Environment:
Description:
I've been working on migrating my company to Conan 2.x. At this point I've migrated all recipes (~100) to Conan 2.x. The most complex application with ~55 dependencies successfully builds - let's call it "appx". I'm running into a problem with an application that pulls in a library that the complex application generates - let's call it "utilx". I understand that it's a bit quirky that appx also generates a library for utilx to use.
utilx only depends on appx. The
conan create
command for utilx gets stuck - the Conan process uses almost all the memory (16GB) and CPU (Intel Xeon with 4 cores @ 3.8GHz) of a Linux workstation. It gets stuck while it's in the "Computing dependency graph" phase. On the other hand, I can doconan graph info
for utilx and it generates the HTML graph in a timely manner.Clearly there is some sort of issue with dependency graph generation since it appears to work for
conan graph info
but notconan create
in this specific case. I'm looking for guidance as to how to debug theconan create
command's dependency graph generation.How to reproduce it
EDIT: Changed from question format to bug format.
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: