Skip to content

Different behaviour than MRI on Fiber#raise #9297

@katafrakt

Description

@katafrakt

Environment Information

JRuby version: 10.0.4.0, 10.0.3.0
Operating system: Linux burza 6.19.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 04 Mar 2026 18:25:08 +0000 x86_64 GNU/Linux, but also on MacOS

Expected Behavior

The script below behaves the same way in MRI and JRuby.

fiber = Fiber.new do
  begin
    Fiber.yield(:a)
  rescue RuntimeError
  end
  Fiber.yield(:b)
  :done
end

fiber.resume
fiber.raise(RuntimeError.new("oh no!"))
p fiber.resume(:c)

Actual Behavior

On MRI (checked 3.4.7 and 4.0.1):

:done

On JRuby:

FiberError: attempt to resume a resuming fiber
  resume at org/jruby/ext/fiber/ThreadFiber.java:187
  <main> at fiber_raise.rb:12
RuntimeError: oh no!
   raise at org/jruby/ext/fiber/ThreadFiber.java:401
   raise at org/jruby/ext/fiber/ThreadFiber.java:232
  <main> at fiber_raise.rb:11

This was found while attempting to make dry-effects JRuby-compatible. Example CI run: https://github.com/dry-rb/dry-effects/actions/runs/21515027891/job/61991147407

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions