You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: on 10.0.x, Kernel#sleep, Thread::ConditionVariable#wait and Thread::Queue#pop in a non-blocking fiber never call the scheduler's kernel_sleep / block / unblock. They block the whole thread, so every
fiber on an Async reactor stalls. FiberScheduler.kernelSleep/block/unblock exist in core/src/main/java/org/jruby/FiberScheduler.java but nothing in core calls them on the 10.0 line. Fixed on master / 10.1 by #9622
(10.1.2.0), #9790 (Mutex and ConditionVariable) and #9805 (Queue) (10.1.3.0); the jruby-10.0 branch does not have them. (A contended Mutex#lock was not tested here; #9790 covers it too.)
Minimal repro:
# Logs each scheduler hook call; it waits for real (in blocking mode) so callers make progress.classSdeflog(hook)=puts("hook #{hook}")defkernel_sleep(t=nil)=(log("kernel_sleep");Fiber.blocking{Kernel.sleep(t || 0.01)})defblock(blocker,t=nil)=(log("block #{blocker.class}");Fiber.blocking{Kernel.sleep(t || 0.01)};false)defunblock(blocker,fiber)=log("unblock #{blocker.class}")defio_wait(*)=log("io_wait")deffiber(&blk)=Fiber.new(blocking: false, &blk).tap(&:resume)defclose=nilendThread.newdoFiber.set_scheduler(S.new)Fiber.scheduledoputs"sleep:"sleep0.01m=Thread::Mutex.newcv=Thread::ConditionVariable.newputs"cv.wait:"m.synchronize{cv.wait(m,0.01)}puts"queue.pop:"Thread::Queue.new.pop(timeout: 0.01)puts"done"endend.join
Expected (CRuby 3.4.12, JRuby 10.1.3.0):hook kernel_sleep after sleep: and after cv.wait: (CV#wait goes through Mutex#sleep), hook block Thread::Queue after queue.pop:.
Actual (JRuby 10.0.8.0): the four labels only; no hook is called.
Impact: any Async application on 10.0.x (for example a Kafka producer that waits on a ConditionVariable for delivery) stalls the reactor for each wait.
Activity