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

Prerelease package range causes stack overflow in PackageResolver #1432

Closed
rkachowski opened this issue Jan 26, 2016 · 7 comments
Closed

Prerelease package range causes stack overflow in PackageResolver #1432

rkachowski opened this issue Jan 26, 2016 · 7 comments

Comments

@rkachowski
Copy link

We've been using a paket based package system internally to manage nuget packages within our organisation. In recent versions we've noticed a recurring error which forces us to pin to a lower version (we are using 2.39.10, but more investigation is needed to check whether more recent versions are stable)

When using the latest (2.47.2 release and also current master d0846c4 ) we get error when attempting to run paket update. From a brief look it appears that the error is due to recent changes in the prerelease handling code.

We have two situations in our build, one stable version where we wish to pull in only stable releases, and a prerelease version, where all dependencies are pulled in on the latest development/prerelease version.

the paket.dependencies file for a prerelease looks similar to

source http://private_repo
nuget package_name >= 0.0.0-prerelease

In this situation it looks like getCompatibleVersions is only returning non prerelease versions and so the resolver gets stuck in a loop when it recurses on step.

Attached is a sample stack trace
stacktrace.txt

@forki
Copy link
Member

forki commented Jan 26, 2016

sounds like a duplicate of #1392 - is there a way for me to reproduce?

(something like giving me temporary access?)

@rkachowski
Copy link
Author

i'll need to get back to you with a reduced test case...

@flowsprenger
Copy link
Contributor

This is a small reproducible testcase
https://gist.github.com/flowsprenger/3d1b0dd7f6168b9e31b9

Running setup_packages.sh with Paket 2.39.10 it will yield:
Resolving packages for group Main:

  • Paket.Test.D 1.0.0-prerelease
  • Paket.Test.B 1.0.0
  • Paket.Test.C 1.0.0-prerelease
  • Paket.Test.A 1.0.0

Later versions will yield:

Paket version 2.50.2.0
Resolving packages for group Main:
 - Paket.Test.D 1.0.0-prerelease
 - Paket.Test.B 1.0.0

Unhandled Exception:
System.StackOverflowException: The requested operation caused a stack overflow.
  at Microsoft.FSharp.Core.LanguagePrimitives IntrinsicFunctions.TypeTestGeneric[Double] (System.Object source) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.LanguagePrimitives HashCompare.GenericEqualityObj (Boolean er, IEqualityComparer iec, System.Object xobj, System.Object yobj) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.LanguagePrimitives HashCompare.GenericEqualityWithComparerIntrinsic[PreRelease] (IEqualityComparer comp, Paket.PreRelease x, Paket.PreRelease y) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.FSharpOption`1[Paket.PreRelease].Equals (System.Object obj, IEqualityComparer comp) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.LanguagePrimitives HashCompare.GenericEqualityObj (Boolean er, IEqualityComparer iec, System.Object xobj, System.Object yobj) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.LanguagePrimitives HashCompare.GenericEqualityIntrinsic[FSharpOption`1] (Microsoft.FSharp.Core.FSharpOption`1 x, Microsoft.FSharp.Core.FSharpOption`1 y) [0x00000] in <filename unknown>:0
  at Paket.SemVerInfo.Equals (System.Object yobj) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.LanguagePrimitives HashCompare.GenericEqualityObj (Boolean er, IEqualityComparer iec, System.Object xobj, System.Object yobj) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.LanguagePrimitives HashCompare.GenericEqualityWithComparerIntrinsic[SemVerInfo] (IEqualityComparer comp, Paket.SemVerInfo x, Paket.SemVerInfo y) [0x00000] in <filename unknown>:0
  at Paket.VersionRange.Equals (System.Object obj, IEqualityComparer comp) [0x00000] in <filename unknown>:0
  at Paket.VersionRequirement.Equals (System.Object obj, IEqualityComparer comp) [0x00000] in <filename unknown>:0
  at Paket.Requirements PackageRequirement.Equals (System.Object that) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.LanguagePrimitives HashCompare.GenericEqualityObj (Boolean er, IEqualityComparer iec, System.Object xobj, System.Object yobj) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.LanguagePrimitives HashCompare.GenericEqualityIntrinsic[PackageRequirement] (Paket.PackageRequirement x, Paket.PackageRequirement y) [0x00000] in <filename unknown>:0
  at Paket.Requirements PackageRequirement.Compare[Int32] (Paket.PackageRequirement x, Paket.PackageRequirement y, Microsoft.FSharp.Core.FSharpOption`1 startWithPackage, Int32 boostX, Int32 boostY) [0x00000] in <filename unknown>:0
  at Paket.Requirements PackageRequirement.System-IComparable-CompareTo (System.Object that) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.LanguagePrimitives HashCompare.GenericCompare (Microsoft.FSharp.Core.GenericComparer comp, System.Object xobj, System.Object yobj) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.LanguagePrimitives HashCompare.GenericComparisonWithComparerIntrinsic[PackageRequirement] (IComparer comp, Paket.PackageRequirement x, Paket.PackageRequirement y) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.LanguagePrimitives HashCompare.GenericComparisonIntrinsic[PackageRequirement] (Paket.PackageRequirement x, Paket.PackageRequirement y) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.LanguagePrimitives -cctor@2379-2[Paket.Requirements PackageRequirement].System-Collections-Generic-IComparer`1-Compare (Paket.PackageRequirement x, Paket.PackageRequirement y) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Collections.SetTreeModule.split[PackageRequirement] (IComparer`1 comparer, Paket.PackageRequirement pivot, Microsoft.FSharp.Collections.SetTree`1 t) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Collections.SetTreeModule.union[PackageRequirement] (IComparer`1 comparer, Microsoft.FSharp.Collections.SetTree`1 t1, Microsoft.FSharp.Collections.SetTree`1 t2) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Collections.FSharpSet`1[Paket.Requirements PackageRequirement].op_Addition (Microsoft.FSharp.Collections.FSharpSet`1 set1, Microsoft.FSharp.Collections.FSharpSet`1 set2) [0x00000] in <filename unknown>:0
  at Paket.PackageResolver.getConflicts@359 (System.Collections.Generic.HashSet`1 knownConflicts, Microsoft.FSharp.Collections.FSharpMap`2 filteredVersions, Microsoft.FSharp.Collections.FSharpSet`1 closedRequirements, Microsoft.FSharp.Collections.FSharpSet`1 openRequirements, Paket.PackageRequirement currentRequirement) [0x00000] in <filename unknown>:0
  at Paket.PackageResolver.step@419 (Paket.UpdateMode updateMode, Microsoft.FSharp.Collections.FSharpList`1 sources, Paket.GroupName groupName, Microsoft.FSharp.Core.FSharpOption`1 globalStrategyForTransitives, Microsoft.FSharp.Core.FSharpOption`1 globalStrategyForDirectDependencies, Paket.FrameworkRestrictions globalFrameworkRestrictions, Microsoft.FSharp.Core.FSharpFunc`2 getVersionsF, Microsoft.FSharp.Core.FSharpFunc`2 getPackageDetailsF, Microsoft.FSharp.Core.FSharpRef`1 lastConflictReported, Microsoft.FSharp.Core.FSharpOption`1 packageFilter, IDictionary`2 rootSettings, System.Collections.Generic.Dictionary`2 exploredPackages, System.Collections.Generic.Dictionary`2 conflictHistory, System.Collections.Generic.HashSet`1 knownConflicts, Microsoft.FSharp.Core.FSharpRef`1 tryRelaxed, Boolean relax, Microsoft.FSharp.Collections.FSharpMap`2 filteredVersions, Microsoft.FSharp.Collections.FSharpMap`2 currentResolution, Microsoft.FSharp.Collections.FSharpSet`1 closedRequirements, Microsoft.FSharp.Collections.FSharpSet`1 openRequirements) [0x00000] in <filename unknown>:0
  at Paket.PackageResolver.step@419 (Paket.UpdateMode updateMode, Microsoft.FSharp.Collections.FSharpList`1 sources, Paket.GroupName groupName, Microsoft.FSharp.Core.FSharpOption`1 globalStrategyForTransitives, Microsoft.FSharp.Core.FSharpOption`1 globalStrategyForDirectDependencies, Paket.FrameworkRestrictions globalFrameworkRestrictions, Microsoft.FSharp.Core.FSharpFunc`2 getVersionsF, Microsoft.FSharp.Core.FSharpFunc`2 getPackageDetailsF, Microsoft.FSharp.Core.FSharpRef`1 lastConflictReported, Microsoft.FSharp.Core.FSharpOption`1 packageFilter, IDictionary`2 rootSettings, System.Collections.Generic.Dictionary`2 exploredPackages, System.Collections.Generic.Dictionary`2 conflictHistory, System.Collections.Generic.HashSet`1 knownConflicts, Microsoft.FSharp.Core.FSharpRef`1 tryRelaxed, Boolean relax, Microsoft.FSharp.Collections.FSharpMap`2 filteredVersions, Microsoft.FSharp.Collections.FSharpMap`2 currentResolution, Microsoft.FSharp.Collections.FSharpSet`1 closedRequirements, Microsoft.FSharp.Collections.FSharpSet`1 openRequirements) [0x00000] in <filename unknown>:0

so it seems to happen when one package defines a prerelease dependency and the other one a release dependency. Earlier this would resolve to the release dependency being picked.

@forki
Copy link
Member

forki commented Feb 11, 2016

AWESOME REPRO! KUDOS!

I'll take it from here

take

forki added a commit that referenced this issue Feb 11, 2016
forki added a commit that referenced this issue Feb 11, 2016
forki added a commit that referenced this issue Feb 11, 2016
@forki
Copy link
Member

forki commented Feb 11, 2016

Please test version 2.50.3 and see discussion in #1470

forki added a commit that referenced this issue Feb 11, 2016
@forki
Copy link
Member

forki commented Feb 11, 2016

Now the second fix is perfectly matching the discussion in #1392 but boy I would never have guessed that reason without a proper repro

@flowsprenger
Copy link
Contributor

Glad I could help :) So far it looks good. Thanks for the fix.

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

No branches or pull requests

3 participants