Uh oh!
There was an error while loading. Please reload this page.
libtest: Don't panic if unable to spawn thread - #78165
Conversation
Instead just run the test synchronously.
rust-highfive
commented
Oct 20, 2020
(rust_highfive has picked a reviewer for you, use r? to override) |
| let cfg = thread::Builder::new().name(name.as_slice().to_owned()); | ||
| cfg.spawn(runtest).unwrap(); | ||
| if cfg.spawn(runtest).is_err() { | ||
| // If we can't spawn a new thread, just run the test synchronously. |
There was a problem hiding this comment.
Should we print a message letting the user know?
camelid
commented
Oct 20, 2020
I don't have a ton of experience with closures: what's the best way to fix this? |
jyn514
commented
Oct 20, 2020
@camelid there is not a simple way to fix it; The simplest way is probably to get |
camelid
commented
Oct 20, 2020
Should be fixed now. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
jyn514
commented
Oct 22, 2020
@camelid can you remove 'may fix' from the commit message? This PR isn't actually fixing the same problem (although it might fix a related one). |
bors
commented
Jan 26, 2021
☔ The latest upstream changes (presumably #81367) made this pull request unmergeable. Please resolve the merge conflicts. |
andersk
commented
Jan 26, 2021
There’s probably a better way, but one brute-force strategy that works without much thinking would be to encase the closure in an let runtest = Arc::new(Mutex::new(Some(move || match opts.strategy{
…
})));
…
cfg.spawn({let runtest = Arc::clone(&runtest);move || runtest.lock().unwrap().take().unwrap()()})
…
runtest.lock().unwrap().take().unwrap()() |
@camelid Any update? I would like to take over this if you run out of
I think |
andersk
commented
Jan 29, 2021
|
ghost
commented
Jan 29, 2021
I meant thay can be used after encountering |
jyn514
commented
Jan 29, 2021
@hyd-dev I think it's fine to open a new PR and mention this one. |
jyn514
commented
Jan 29, 2021
err actually this is waiting-on-review, not waiting-on-author, so I don't know if there's any point to a new PR. |
camelid
commented
Jan 29, 2021
This change doesn't work, so a new PR still makes sense 🙃 The reason it hasn't been reviewed is (1) it doesn't work and (2) withoutboats is taking a break. |
ghost
commented
Jan 30, 2021
New PR: #81546 |
… r=Mark-Simulacrum
[libtest] Run the test synchronously when hitting thread limit
libtest currently panics if it hits the thread limit. This often results in spurious test failures (<code>thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }'</code> ... `error: test failed, to rerun pass '--lib'`). This PR makes it continue to run the test synchronously if it runs out of threads.
Closesrust-lang#78165.
`@rustbot` label: A-libtest T-libs
Instead just run the test synchronously.