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

Fix close_output test. #8587

Merged
merged 1 commit into from Aug 4, 2020
Merged

Fix close_output test. #8587

merged 1 commit into from Aug 4, 2020

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Aug 4, 2020

The close_output test was randomly failing on rust-lang/rust's CI. This should fix the error. I ran the test in a loop on the rust-lang 16-thread CPU for 10,000 times over the course of 1.5 hours without fail. The same stress test without this patch failed relatively easily.

I'm a bit on the fence, as this means the test is no longer testing a realistic scenario (the compiler usually doesn't emit a megabyte of diagnostics). Moving this test to a single-threaded runner should also solve the problem. I can't decide if it matters enough to bother. WDYT?

Closes #8564

@rust-highfive
Copy link

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 4, 2020
@Mark-Simulacrum
Copy link
Member

From a "speed" perspective, do we have an idea of which is faster? I suspect the 1MB of output is faster personally, but maybe I'm wrong? We could also consider locking stdout in the loop instead of re-locking it on every iteration...

@ehuss
Copy link
Contributor Author

ehuss commented Aug 4, 2020

Yea, this is quite a bit faster and simpler. On my system, this test takes about 3s. The alternative would mean building and linking a whole separate test. I guess another alternative would be to #[ignore] it and then run cargo test -- --test-threads=1 --ignored build::close_output. Either way, it makes running tests more awkward and complicated.

@alexcrichton
Copy link
Member

@bors: r+

FWIW I think the forked process theory is at least one explanation. A thread forks, holds open the file descriptor, then gets unscheduled. While it's unscheduled the entire test finishes and Cargo writes everything to a defunkt pipe, not failing. We then fail the test because Cargo didn't fail (because all output fit in the pipe buffer). There may be other bugs in play but that's at least one sure-fire way to expose this bug.

@bors
Copy link
Collaborator

bors commented Aug 4, 2020

📌 Commit 191250b has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 4, 2020
@bors
Copy link
Collaborator

bors commented Aug 4, 2020

⌛ Testing commit 191250b with merge 1653f35...

@bors
Copy link
Collaborator

bors commented Aug 4, 2020

☀️ Test successful - checks-actions
Approved by: alexcrichton
Pushing 1653f35 to master...

@bors bors merged commit 1653f35 into rust-lang:master Aug 4, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 5, 2020
Update cargo

8 commits in 2d5c2381e4e50484bf281fc1bfe19743aa9eb37a..1653f354644834073d6d2541e27fae94588e685e
2020-07-31 21:56:08 +0000 to 2020-08-04 23:14:37 +0000
- Fix close_output test. (rust-lang/cargo#8587)
- clippy fixes, use matches! macro in more places (rust-lang/cargo#8575)
- Display embedded man pages for built-in commands. (rust-lang/cargo#8456)
- Add mdman for generating man pages. (rust-lang/cargo#8577)
- Fix typo 'more then' -> 'more than' in error and comments (rust-lang/cargo#8581)
- cargo login: make login message less ambiguous (rust-lang/cargo#8579)
- Fix broken link in Build Cache chapter. (rust-lang/cargo#8578)
- Fix intra-doc tests for renamed lint. (rust-lang/cargo#8576)
@ehuss ehuss added this to the 1.47.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

close_output test is randomly failing
5 participants