CPU session with duration_secs reports less than the requested duration (two clocks race)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Read lsp-profiler-dotnet's cpu.rs attach and wait_for_stop flow alongside lsp-profiler's session.rs CpuSession::new and recorded_secs(). Trace how the two timers and receiver closure determine the reported duration, then check existing CPU session tests. Done means a session started with a duration of 2 seconds reports the requested duration when it stops automatically, while still handling target exits correctly.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
A CPU session started with duration_secs: 2 reports duration_secs of ~1.946 instead of 2. Seen consistently on 0.10.1 with the prebuilt osx-arm64 engine (2/2 runs).
Mechanism
Two clocks measure the same duration:
lsp-profiler-dotnetcpu.rsattachspawnsforward(...)right afterawait_attached.wait_for_stopstarts its owntokio::time::Instantand closes the sample sink whenlimitelapses.lsp-profilersession.rsCpuSession::newsetsstarted_at = Instant::now()only afterattachreturns, which is later.
So the forwarder's timer expires first and closes the receiver. ended() returns true through receiver.is_closed(), and recorded_secs() returns elapsed.min(limit) with elapsed ≈ limit − (attach→session gap), for example 1.9457 s.
Repro
A consumer e2e test (SharpLsp profiler-lsp-cpu-e2e, "a duration on start stops the session by itself"):
cpu.start { pid, duration_secs: 2 }against a busy .NET process.- Poll
cpu.listuntil the session is gone. cpu.stop { session_id }.
Expected: duration_secs == 2 ([PROF-CPU-SESSIONS] duration).
Actual: 1.945700541, 1.947925084.
Suggested fix
Use one clock. Either hand the session's started_at (or the deadline) to the forwarder, or have recorded_secs() return limit when the session ended because its duration elapsed rather than because the target exited.
- Lingua principale
- Rust
- Stelle
- 9
- Fork
- 0
- Merge medio
- 2h 28m
- PR unite (30g)
- 25
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Nimblesite/lspkit
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Nimblesite/lspkit#24 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Nimblesite/lspkit
Issue simili
-
Heading anchor links have no icon: AnchorJS is initialised with an empty `icon`Forse già presa @cscheid l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
quarto-dev/q2#1419 ·
I maintainer di solito rispondono entro 1 giorno
-
needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
pbakaus/impeccable#1718 ·
I maintainer di solito rispondono entro 1 giorno
-
agent:triaged bug bughunt pm:bazel priority:p3 ux
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
SocketDev/socket-patch#2386 ·
I maintainer di solito rispondono entro 1 giorno
-
Uncaught index-out-of-bounds panic in `minijinja::value::ops::slice` on `{{ ''[::-1] }}` (v2.24.0)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Fix All + Enforce overwrites unsaved edits to .editorconfig / Directory.Build.props / sharplsp.tomlApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Nimblesite/SharpLsp#644 ·
I maintainer di solito rispondono entro 1 giorno