python / python/cpython

Potential Windows-specific lost event race in the implementation of time.sleep

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

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

extension-modules OS-windows type-bug
主要言語
Python
スター
77.2k
フォーク
36k
PR マージ指標
PR 指標を取得中

説明

Bug description:

In the Windows-specific implementation of time.sleep there appears this code:

https://github.com/python/cpython/blob/b706ff003c536c5bca24dfdd3a8917bffcfa3df1/Modules/timemodule.c#L2341-L2345

If a control-C event happens after PyErr_CheckSignals returns, but before ResetEvent is called, I believe that event may be lost.

This is probably a hard race window to hit, and I don't have a Windows development environment, so I have not confirmed that it is possible.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

リンク先の行にある Modules/timemodule.c の Windows 固有の time.sleep 実装から始め、次に PyErr_CheckSignals と ResetEvent の順序を調べてください。Windows でその間に control-C イベントが発生する可能性があるかを調査してください。失われたイベントの競合状態を確認または否定し、該当する場合はカバレッジを追加して動作を文書化または修正できれば完了です。

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

評価

技術スタック
python
領域
operating-systems
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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