-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Panic - Attempt to subtract with overflow #4460
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
Comments
I'll attempt to repro this with a smaller use case. |
I have tracked down the source of the configuration problem. It has nothing to do with depending on a local crate path it is conflicting dependencies in crates.. The cause is that the crates postgres-protocol and blake2 both depend on different versions of generic-array and typenum. in this case, postgres_r2d2 is also an optional dependency (but the feature is enabled by default)
|
Setting the version to |
Running in debug, I do see 408 occurrences of :
before it runs out of siblings. |
It seems that cur, set by remaining_siblings.cur_index() is only really used for debugging purposes. The real issue is that it is in a state where it is cycling through the dependency graph infinitely. I'm still trying to understand the algorithm and figure out how it could get into such a state.. |
Here is the most minimal Cargo.toml I can create that repros the problem :
|
If you just make a project with deps on r2d2_postgres and blake2. It detects the un-resolveable conflict for the typenum version dependencies. But when you add in some additional optional dependencies, it can't seem to traverse the graph. |
Also, I would note that there have been 2 major refactorings to the resolve module. One a couple weeks ago and one in November of last year. This toml breaks in the same way on the versions prior to those. |
Thanks for the investigation and the report here @rrichardson! I'll take a look now and see what's up |
Ok so the infinite loop here I believe is an instance of #4066 where this is an un-resolvable crate graph but Cargo isn't doing a great job of telling you that, unfortunately. (it takes forever to reach this conclusion) The panic in debug mode though sounds like it's definitely a bug! |
@rrichardson minimal case does not reproduce for me. So I think some new versions of the dependencies have prevented it reproducing. Maybe if we can limit the range of the dependencies we can reproduce. This sounds like a really interesting one to dig into. |
I believe this panic was since fixed, so closing. |
at https://github.com/rust-lang/cargo/blob/master/src/cargo/core/resolver/mod.rs#L453
Running in release mode this just spins in a loop forever, since it doesn't panic on the arithmetic.
The issue arrises when I attempt to depend upon both blake2 and postgres.
update 11:58
Both crates depend on different versions of generic array and typenum, and it seems to break when trying to resolve the dependencies.
*update 14:39"
Here is a minimal Cargo.toml that repros the problem :
#4460 (comment)
Running the latest nightly as of Sep 1 2017.
cargo stack trace
Cargo.toml
The text was updated successfully, but these errors were encountered: