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

オープン
#157 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
12/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
c, python

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
72
フォーク
14
平均マージ
15時間 29分
マージ済み PR(30日)
40

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hyperlight-dev/hyperlight-unikraft のほかの issue

hyperlight-dev/hyperlight-unikraft の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。