-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Cyclic dependencies result in deadlock #834
Comments
I thought I had a specific test to ensure that this didn't happen... Should not so hard to find though! |
The problem here seems to be, that there actually are checks for cyclic dependencies in place but they are skipped in this case. The cause is the following section in src/cargo/core/resolver/mod.rs: 260 let my_cx = if early_return {
261 my_cx
262 } else {
... ... checks for cyclic dependencies are done here ... The checks are skipped if early_return is true, which gets set here: 239 let early_return = {
240 my_cx.resolve.graph.link(parent.get_package_id().clone(),
241 candidate.get_package_id().clone());
242 let prev = match my_cx.activations.entry(key.clone()) {
243 Occupied(e) => e.into_mut(),
244 Vacant(e) => e.set(Vec::new()),
245 };
246 if prev.iter().any(|c| c == candidate) {
247 match cx.resolve.features(candidate.get_package_id()) {
248 Some(prev_features) => {
249 features.iter().all(|f| prev_features.contains(f))
250 }
251 None => features.len() == 0,
252 }
253 } else {
254 my_cx.resolve.graph.add(candidate.get_package_id().clone(), &[]);
255 prev.push(candidate.clone());
256 false
257 }
258 };
259 As a quick test I tried to just remove the "early return" logic and it seems to do the trick. Cyclic dependencies are reported correctly then. Unfortunately I do not quite understand what this last segment actually does. |
I finally had the time to dig a little deeper into this and found that the problem was introduced in 7db89ed. |
with both
d/src/lib.rs
ande/src/lib.rs
empty.RUST_LOG=cargo cargo build
ind
gives:and then it hangs using no CPU. Backtraces:
The text was updated successfully, but these errors were encountered: