Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for RFC 1977: public & private dependencies, as it relates to the resolver #6129
Comments
Eh2406
added
A-dependency-resolution
C-tracking-issue
labels
Oct 3, 2018
This comment has been minimized.
This comment has been minimized.
|
Adding new dependencies seems fine by me! My historical strategy with the resolver has been "don't add any fancy representation tricks, profile Servo, add tricks as necessary" |
This comment has been minimized.
This comment has been minimized.
|
I have a branch that stubs out getting this working. It involves all the ugly things I can think of. The state is a mess of big nested data structures. The algorithm is a bunch of nested loops in the hottest part of the resolver. It is not even checking for redundant work. The code is mostly repeated between the code that check if a candidate can be added and where the the candidate is added. Several existing optimizations are completely removed in the case that a pub-dep has ben looked at. The error messages are just "Todo", and most of the commit messages are "oops". But it is working! I modified the passes_validation to check for pub-dep conflicts, then modified the Next try the So my plan for the Impl day at RBR is to attempt to get edit: the cleaned up history is at https://github.com/Eh2406/cargo/tree/pub-dep |
This comment has been minimized.
This comment has been minimized.
|
Cc @necaris |
This comment has been minimized.
This comment has been minimized.
|
So at RBR I got the history cleaned up. Alex and I reviewed the progress so far and a plan for how to re enable backjumping without losing correctness. That backjumping strategy was implemented today. Unfortunately, the fuzz tests are finding kasese of exponential blowup (50_000 ticks). I suspect it is similar to #5213, in which we backtrack to where On a different note I also ran the other resolver tests, we have several that are hitting the 30 sec timeout on this branch. So we will need to work on per tick performance before this can merge. |
This comment has been minimized.
This comment has been minimized.
|
Good news If you run proptest overnight with |
This comment has been minimized.
This comment has been minimized.
|
I am (for now) ignoring the fact that the current strategy will fail to resolve when there is a valid solution in rare circumstances. I have cleaned up the case of exponential blow up, so I understand why it is happening. What I don't understand is why It is not happening using normal deps. (it is a lot harder to write, but should be possible.) I am investigating that, hoping that I will either find an optimization I forgot to add to pub/priv deps, or a case that can be reproduced on master. |
This comment has been minimized.
This comment has been minimized.
|
I can now confirm that the Unfortunately, a simple solution did not work. I think doing something special for |
This comment has been minimized.
This comment has been minimized.
|
I implemented the "obviously correct thing", and the fuzz tests pointed out that it was not backtracking correctly. I assumed I had done something silly, but could not find it. Then I got distracted by #6258. Coming back to it the minimized test was correctly pointing out that the "obviously correct thing" will not work. It is possible to make a pub-dep violation, without changing |
This was referenced Nov 19, 2018
added a commit
that referenced
this issue
Nov 21, 2018
This comment has been minimized.
This comment has been minimized.
|
I have a branch where I have implemented both versions simultaneously. Like the "obviously correct thing" it records every PID in the path from the dependency that can see the conflict to both conflicting crates. Like the strategy Alex and I came up with at RBR, it ensures the parents relationship is still active when the Back Jumping occurs. Because it looks at the dependency tree it passes the test the previous strategy failed. Because it will records all the PIDs involved in conflict it can learn like #5213. Unfortunately, because it adds a lot of things to the conflict it is a highly efficient way of creating a test case like #6283. So efficient that, In debug the fuzz test only tell me that it hit the 50k limit, In release the fuzz test only tell me that there are cases that took longer than 90sec to resolve! I have to say, adding new features to the resolver has gotten a lot harder now that we have fuzz tests making sure that they are correct, complete, and efficient. :-P |
Eh2406 commentedOct 3, 2018
This is a sub part of the discussion of implementation of RFC 1977, specifically how the resolver could implement this protocol. The main Tracking issue is at rust-lang/rust#44663.
This comment rust-lang/rfcs#1977 (comment) described the properties we want to uphold the way that fits best with my brain.
So to use the termanology, I feel like when we are adding a packedge
Bwe need to walk up the dependency tree to all potentialC's that can see the addition to test if there is a conflictingA.That can be done pretty fast if we have a fast way to walk up dependency tree and a fast way to see all the pub reachable packages for each ancestor. (Neither of which we have at this time.)
But that feels like a lot of state to be cloned for each tick.
Currently we avoid the expensive clones with extensive use of RC.
Is it time to add a im-rs dependency?
Is there a better algorithm?
Is there a small part that would make a good starting PR?