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

jobserver::jobserver_exists hangs with only one CPU #8595

Closed
cuviper opened this issue Aug 7, 2020 · 2 comments · Fixed by #8598
Closed

jobserver::jobserver_exists hangs with only one CPU #8595

cuviper opened this issue Aug 7, 2020 · 2 comments · Fixed by #8598
Labels
C-bug Category: bug

Comments

@cuviper
Copy link
Member

cuviper commented Aug 7, 2020

Problem

Running the cargo testsuite on a single-CPU machine hangs on jobserver::jobserver_exists.
This can also be reproduced on other machines by limiting the available CPUs, e.g. with taskset on Linux.

Steps

  1. cargo test --test testsuite --no-run
  2. taskset --cpu-list 0 cargo test --test testsuite -- --exact jobserver::jobserver_exists

Possible Solution(s)

That test has a build script reading CARGO_MAKEFLAGS and trying to read/write the jobserver pipes, taking and releasing a job token. I suppose in this nested invocation, all tokens must already be in use? But there's no problem when I use cargo test -j1 without restricting the taskset, so I'm not sure what's the difference.

Notes

Output of cargo version:

cargo 1.47.0-nightly (1653f3546 2020-08-04)
release: 1.47.0
commit-hash: 1653f354644834073d6d2541e27fae94588e685e
commit-date: 2020-08-04

First seen in the rpm build of 1.45.2 for RHEL 8.3.0 ppc64le while running the testsuite. Usually I get a multi-CPU builder though, so I can't say this is a new issue.

Reproduced on Fedora 32 x86_64 with cargo nightly, by limiting the CPUs with taskset as above.

@alexcrichton
Copy link
Member

FWIW cargo test -j1 will build the tests themselves in single-threaded mode but that jobserver isn't inhereited by the test suite process itself, so the test suite will create its own second jobserver with the number of CPUs on the system. In any case this is a pretty easy test to fix, just need to pass -j<greater-than-one>!

@cuviper
Copy link
Member Author

cuviper commented Aug 7, 2020

but that jobserver isn't inhereited by the test suite process itself

That explains it! I can confirm that adding -j2 within that test works -- I'll send a PR shortly (just saw #8598).

bors added a commit that referenced this issue Aug 9, 2020
Fix jobserver_exists test on single-cpu systems

Closes #8595
@bors bors closed this as completed in 02fc16a Aug 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants