-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Some clippy lints #2825
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
Some clippy lints #2825
Conversation
|
bors r+ |
2825: Some clippy lints r=matklad a=kjeremy Co-authored-by: kjeremy <[email protected]>
Build failed
|
|
bors retry |
2825: Some clippy lints r=matklad a=kjeremy Co-authored-by: kjeremy <[email protected]>
|
@kjeremy I'll disable windows gating. Would you be interested in looking into why this test fails on windows? It should pass I think, so there might be a real issue hidden there! |
|
@matklad annoyingly it passes on my machine. |
|
@kjeremy just to sanity check, you run with |
Build succeeded
|
|
@matklad I had a hypothesis that the windows workers, probably being multi-tenant, are a bit overworked and thus not the best place for timing sensitive tests. Why the situtation on linux, or especially macOS, is better, is beyond me. Maybe the windows scheduler is significantly less fair? |
|
The tests test that we do |
|
@matklad It's |
|
Right. The OTOH, the background work we need to do, without blocking |
|
In other words, it is time-senstive in an absolute sense, but we have like 3 orders of magnitude error margin here in both directions |
|
Here is the output of in my Windows machine: (I
|
|
@matklad it still passes locally with |
|
@edwin0cheng yeah, this is exactly the expected behavior: we test that we quickly complete "foreground" job, while background tasks slowly completes in background. |
|
Okay, I could almost reproduce this bug by setting the CPU Affinity to 1 in Task Manager: Maybe github windows VM is single core ? |
|
Interesting! So that means we need to set thread priorities on windows
somehow?
…On Mon, 13 Jan 2020 at 19:31, Edwin Cheng ***@***.***> wrote:
Okay, I tried kind of reproduce this bug by setting the CPU Affinity to 1
in Task Manager:
[crates\ra_lsp_server\tests\heavy_tests\main.rs:535] elapsed = 929.6164ms
test diagnostics_dont_block_typing ... test diagnostics_dont_block_typing has been running for over 60 seconds
Maybe github windows VM is single core ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2825>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANB3M4IX32WALI36WZ2EQTQ5SXQFANCNFSM4KGFA76A>
.
|
|
… On Monday, 13 January 2020, Aleksey Kladov ***@***.***> wrote:
Interesting! So that means we need to set thread priorities on windows
somehow?
On Mon, 13 Jan 2020 at 19:31, Edwin Cheng ***@***.***>
wrote:
> Okay, I tried kind of reproduce this bug by setting the CPU Affinity to 1
> in Task Manager:
>
> [crates\ra_lsp_server\tests\heavy_tests\main.rs:535] elapsed = 929.6164ms
> test diagnostics_dont_block_typing ... test diagnostics_dont_block_typing has been running for over 60 seconds
>
> Maybe github windows VM is single core ?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#2825>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AANB3M4IX32WALI36WZ2EQTQ5SXQFANCNFSM4KGFA76A>
> .
>
|
I changed the code and did some tests on my Windows machine:
#[test]
fn diagnostics_dont_block_typing() {
if skip_slow_tests() {
return;
}
unsafe {
let process = winapi::um::processthreadsapi::GetCurrentProcess();
let mask = 1;
winapi::um::winbase::SetProcessAffinityMask(process, mask);
}
#[test]
fn diagnostics_dont_block_typing() {
if skip_slow_tests() {
return;
}
.....
let elapsed = start.elapsed();
assert!(elapsed.as_millis() < 2000, "typing enter took {:?}", elapsed);
dbg!(elapsed);
}
pool_dispatcher
.on_sync::<req::CollectGarbage>(|s, ()| Ok(s.collect_garbage()))?
.on_sync::<req::JoinLines>(|s, p| handlers::handle_join_lines(s.snapshot(), p))?
.on_sync::<req::OnEnter>(|s, p| {
use std::io::Write;
let _ = writeln!(&mut std::io::stderr(), "start!");
let start = std::time::Instant::now();
let r = handlers::handle_on_enter(s.snapshot(), p);
dbg!(start.elapsed());
r
})?The result is quite interesting : You can see the actual processing time is quite fast (1.0432ms), but the total elapsed time is around 1 second, which means we are blocking on the main loop !! So I added a pub fn main_loop(
ws_roots: Vec<PathBuf>,
client_caps: ClientCapabilities,
config: ServerConfig,
connection: Connection,
) -> Result<()> {
....
unsafe {
let tid = winapi::um::processthreadsapi::GetCurrentThread();
winapi::um::processthreadsapi::SetThreadPriority(tid, 1);
}
log::info!("server initialized, serving requests");
{
let task_sender = task_sender;
let libdata_sender = libdata_sender;
loop {
log::trace!("selecting");
let event = select! {
...And it is the result : |
|
Fascinating! Opened #2835 |
No description provided.