From: "k0kubun (Takashi Kokubun) via ruby-core" Date: 2026-01-13T01:15:11+00:00 Subject: [ruby-core:124493] [Ruby Bug#21812] Kernel#sleep without arguments returns immediately when subprocess exits in another thread (regression in Ruby 4.0) Issue #21812 has been updated by k0kubun (Takashi Kokubun). Backport changed from 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED to 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONE ruby_4_0 commit:ac596948d4008c6e117449786c62de4e45e434bf merged revision(s) commit:7e81bf5c0c8f43602e6d901f4253dca2f3d71745. ---------------------------------------- Bug #21812: Kernel#sleep without arguments returns immediately when subprocess exits in another thread (regression in Ruby 4.0) https://bugs.ruby-lang.org/issues/21812#change-116045 * Author: jaimevelaz (Jaime Velaz) * Status: Closed * Assignee: luke-gru (Luke Gruber) * ruby -v: ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [arm64-darwin25] * Backport: 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONE ---------------------------------------- **Description** In Ruby 4.0.0, Kernel#sleep without arguments returns 0 immediately when a subprocess (spawned via backticks in another thread) exits. This is a regression from Ruby 3.4.8 where sleep blocks indefinitely as expected. Note: sleep(N) with an argument is not affected. --- **Steps to reproduce** ``` # test_sleep.rb Thread.new do sleep 0.3 `echo hello` # Spawns subprocess puts "Subprocess exited" end puts "Main thread sleeping..." result = sleep # Should block forever puts "sleep returned: #{result.inspect}" ``` Run with: `$ ruby test_sleep.rb` --- Actual result (Ruby 4.0.0): Main thread sleeping... Subprocess exited sleep returned: 0 The program exits immediately after the subprocess completes. --- Expected result (Ruby 3.4.8 behavior): Main thread sleeping... Subprocess exited (process blocks indefinitely until interrupted by signal) The program should block forever until explicitly interrupted by SIGINT/SIGTERM. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/