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

Skip resolved child dependencies in the new resolver if an identical one has already been resolved #6258

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

jeffkl
Copy link
Contributor

@jeffkl jeffkl commented Feb 6, 2025

Bug

Fixes: NuGet/Home#14025

Description

The new dependency resolver queues up all of the children of a dependency as long as they are not suppressed or are direct package references. Depending on your graph, this is fine but in some cases it was discovered that the algorithm would queue up millions of items. This causes restore to be very slow compared to the legacy one and in some cases restore fails with an exception because it cannot create a queue big enough for the items.

This fix checks child dependencies before queuing them. They can be skipped if a resolved dependency has already been selected with the same version and same suppressions. This mimics the same behavior when the resolver dequeues an item to process so this really just keeps dependencies from being queued in the first place.

I also rearranged some checks in an attempt to make perf a little better, there is no point in evaluating runtime dependencies of a child that is going to be skipped.

Unfortunately, there's no good test for this since I was only able to reproduce it with a very large project set. I verified these changes fix that scenario, as well as verified these changes to not break a few other large repositories.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@jeffkl jeffkl self-assigned this Feb 6, 2025
@jeffkl jeffkl requested a review from a team as a code owner February 6, 2025 23:13
@jeffkl jeffkl force-pushed the dev-jeffkl-depresolver-large-restore-fix branch from 7b3489f to 63c54d0 Compare February 6, 2025 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restore cannot be completed for a large solution
4 participants