at_exit hook sometimes freeze forever when a rails application executes test codes

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
ruby
領域
devtools

調査の方向性

Start by tracing the debug gem's at_exit hook and its behavior after a fork, using the Rails test-code sequence described in the issue as the reproduction context. Check how it waits for non-Ruby child processes and verify that the process finishes successfully without waiting indefinitely.

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

説明

Your environment

  • ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [x86_64-linux]
  • rdbg 1.11.0

Describe the bug

This issue is related to https://github.com/ruby/debug/issues/1113.

Since the at_exit hook waits for all child processes other than the Ruby process, it leads to the following problem in the test code of a real Rails application.

  1. Load the debug gem
  2. The capybara-playwright-driver starts Playwright as a child process
  3. The capybara-playwright-driver registers an at_exit hook to terminate Playwright when the test ends
  4. During test code execution, when a fork occurs, the debug gem registers the at_exit hook
  5. After all test cases have finished, the debug gem's at_exit hook executes first and waits for the child process to terminate, but since the at_exit hook to terminate Playwright does not execute, it continues to wait indefinitely

This can occur normally if the debug gem is required.
If it happens in a CI execution environment, it could result in unnecessary costs by holding computing resources for a long time.

I believe that waiting for all child processes(including not Ruby process) after a fork occurs is a significant issue.

To Reproduce

I described above.

Expected behavior

process finishes successfully.

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

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

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

はじめの一歩

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

ruby/debug のほかの issue

ruby/debug の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

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

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