Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

signals should be blocked in thread when using thread timeout method

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

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

評価

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

調査の方向性

pytest-timeout にあるスレッドベースのタイムアウト実装を見つけ、内部スレッドがどのように開始されるかを確認してください。Issue で説明されている signal.pthread_sigmask の動作を確認し、そのうえで既存のタイムアウト動作を変更せずに、タイムアウトスレッドでシグナルが引き続きブロックされることを検証してください。

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

説明

bug minor

Original report by Christopher Hunt (Bitbucket: chrahunt, GitHub: chrahunt).


Currently in Python it's only possible to change your signal disposition on a thread-specific basis using signal.pthread_sigmask. When a test depends on certain signals being blocked but we use the thread method for pytest-timeout, the signal is still received by the process via the internal thread maintained by pytest-timeout and it is then propagated to the main thread by the Python runtime.

The fix is to surround the thread start with something like

old_mask = signal.pthread_sigmask(signal.SIG_SETMASK, range(1, signal.NSIG))
t.start()
signal.pthread_sigmask(signal.SIG_SETMASK, old_mask)

This works because the signal mask is inherited by spawned threads, and also avoids a potential race condition if we were to set the signal mask inside the thread target function itself.

Currently I work around this issue by patching threading.Thread.start to do the same as above.

主要言語
Python
スター
258
フォーク
69
PR マージ指標
30日以内にマージされた PR はありません

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

pytest-dev/pytest-timeout のほかの issue

pytest-dev/pytest-timeout の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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