test_gc: a sleeping thread is not woken on time while others make short sleeps

Aperta
#157 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
12/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c, python

Direzione di ricerca

Start with just conformance python test_gc and the GCTests.test_trashcan_threads case, then read schedcoop_schedule and the futex-backed condition variables used for the GIL handoff. The payload suggests the stall is in that handoff, and lib/posix-poll/poll.c is where a timing-dependent change showed up. Done means test_gc passes reliably on x86 in CI and locally, and it is removed from conformance/python/known_failures.toml.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

A thread sleeping in time.sleep() is not woken on time while other threads keep running short sleeps, so CPython's test_gc (GCTests.test_trashcan_threads) runs out of guest memory.

The test sleeps for 1 s in its main thread while two worker threads allocate and call time.sleep(0.000001) in a loop. The main thread then sets a flag that stops them. When its sleep overruns, the workers keep allocating until the kernel kills the guest:

ERR:  [libposix_process] <deliver.c @  640> Out of memory: killed process 2 (...)
  • On main (f74bf3d) it is intermittent: conformance (windows) crashed test_gc on #154, 16 s in.
  • With the kernel of #156 it fails every time on x86, in CI (Linux, Windows) and locally (just conformance python test_gc). That kernel's change does not touch sleeping or scheduling; a debug print in lib/posix-poll/poll.c makes it pass again, so the failure depends on timing.
  • Instrumented, the main thread's time.sleep(1.0) took 1.166 s with #156's kernel and 1.000 s with main's.

schedcoop_schedule wakes expired sleepers on every switch, so the stall is more likely in the GIL handoff (condition variables over futexes) between the workers and the main thread.

test_gc is in conformance/python/known_failures.toml (may-fix.threading) until this is fixed.

Lingua principale
Rust
Stelle
72
Fork
14
Merge medio
15h 29m
PR unite (30g)
40

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hyperlight-dev/hyperlight-unikraft

Tutte le issue di hyperlight-dev/hyperlight-unikraft

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.