[ruby-core:121549] [Ruby Bug#21218] SizedQueue not stopping threads in push even when non_block: false

Issue #21218 has been reported by 0raghvendrrao (Raghvendra Rao). ---------------------------------------- Bug #21218: SizedQueue not stopping threads in push even when non_block: false https://bugs.ruby-lang.org/issues/21218 * Author: 0raghvendrrao (Raghvendra Rao) * Status: Open * ruby -v: ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) +YJIT [x86_64-linux] * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- Use this to recreate ``` ruby 3.1.4 :019 > sq.push(1, non_block: true) => #<Thread::SizedQueue:0x00007f39e759af60> 3.1.4 :020 > sq.push(1, non_block: true) (irb):20:in `push': queue full (ThreadError) 3.1.4 :021 > sq.push(1, non_block: false) (irb):21:in `push': queue full (ThreadError) 3.1.4 :022 > sq.push(1) ----thread waits ``` When `non_block` parameter is not passed (neither true/false) only then the threads wait -- https://bugs.ruby-lang.org/

Issue #21218 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Rejected The `non_block` argument is a positional argument, not a keyword argument, and `{non_block: true}` is considered true (only `nil` and `false` are considered false). You want `sq.push(1, false)` to explicitly set the `non_block` argument to false. ---------------------------------------- Bug #21218: SizedQueue not stopping threads in push even when non_block: false https://bugs.ruby-lang.org/issues/21218#change-112580 * Author: 0raghvendrrao (Raghvendra Rao) * Status: Rejected * ruby -v: ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) +YJIT [x86_64-linux] * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- Use this to recreate ``` ruby 3.1.4 :019 > sq.push(1, non_block: true) => #<Thread::SizedQueue:0x00007f39e759af60> 3.1.4 :020 > sq.push(1, non_block: true) (irb):20:in `push': queue full (ThreadError) 3.1.4 :021 > sq.push(1, non_block: false) (irb):21:in `push': queue full (ThreadError) 3.1.4 :022 > sq.push(1) ----thread waits ``` When `non_block` parameter is not passed (neither true/false) only then the threads wait -- https://bugs.ruby-lang.org/
participants (2)
-
0raghvendrrao (Raghvendra Rao)
-
jeremyevans0 (Jeremy Evans)