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

--feature-powerset crashes cargo-hack and my terminal #227

Closed
thomaseizinger opened this issue Nov 17, 2023 · 2 comments
Closed

--feature-powerset crashes cargo-hack and my terminal #227

thomaseizinger opened this issue Nov 17, 2023 · 2 comments
Labels
A-features Area: features (--feature-powerset, --each-feature, etc.)

Comments

@thomaseizinger
Copy link

I'd like to adopt cargo-hack for testing a feature matrix of the libp2p facade crate, see https://github.com/libp2p/rust-libp2p.

Unfortunately, I can't seem to get it to work. I've tried to following locally:

cargo hack --package libp2p check --feature-powerset

This hangs for a few seconds and then crashes my terminal (Alacritty). The libp2p crate does have a few features (~40). Is that a problem?

If I resort to --each-feature, it starts compiling the crate. However, I'd like to use --at-least-one-of and that seems to be only compatible with --feature-powerset.

Let me know how I can provide more debug information or whether you can reproduce that locally.

@taiki-e
Copy link
Owner

taiki-e commented Nov 17, 2023

Thanks for the report. The problem is OOM due to too many feature combinations.

In your case, this can be worked around by --depth option with a value smaller than 8 or 9. (At least on macOS 14)

Btw, with --depth 8, there are 51738694 feature combinations.

I think this is a reasonable limitation since it is not realistic to actually check such a large number of combinations (although should report error instead of crashing), but improving the implementation of the powerset calculation may reduce memory usage.

@thomaseizinger
Copy link
Author

thomaseizinger commented Nov 20, 2023

Ah I see 😅

I guess what I want is --depth 2 and --at-least-one-of!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-features Area: features (--feature-powerset, --each-feature, etc.)
Projects
None yet
Development

No branches or pull requests

2 participants