Infinite loop encountered in requirement solver
benjamin-brewer opened this issue · comments
I'm still trying to dig up an actual mix.exs and mix.lock that will reproduce this, as it's happening in a private repo for me.
Basically, I'm running into an infinite loop for a dependency (jason
) when I hit this function
hex/lib/hex/solver/requirement.ex
Line 101 in cf5b231
(:~>, {1, 3, nil, [], []}, :~>, {1, 2, nil, [], []})
. As in the function just calls itself over and over again when the first and third args are the same.
Like I said, I'll try and come up with an example repo with a lock file that can force this to happen. Thanks!
Other details:
- Mac OS 12.6 Intel
- elixir 1.13.3-otp-24
- erlang 24.2
- archive install of
hex
main repo with someIO.inspects
to track down the loop (cf5b231)
Here is a repo and mix file with an example of the problem. I narrowed it down to a private repo that has a dep spec that is {:jason, "~> 1.2 and ~> 1.3"}
, which I honestly haven't read the docs enough to know if that's even legimate anymore/ever 😅 . We also found locations that were using or
, so those may be a bit more practical? Ex. {:telemetry, "~> 0.4 or ~> 1.0"}
We'll fix those particular specs, but would it be possible to have a nice error message instead of an infinite loop, in this case?
https://github.com/benjamin-brewer/hex_loop_example/blob/main/mix.exs
Thanks for the report. This fix will be included in the next release.