Project

General

Profile

Actions

Bug #20082

open

Killing fibers across threads: unexpected exception

Added by zverok (Victor Shepelev) 11 months ago. Updated 8 months ago.

Status:
Assigned
Target version:
-
[ruby-core:115881]

Description

For providing the example in a changelog, I tried to imitate killing fibers belonging to other threads.
Documentation claims

Raises FiberError if called on a fiber belonging to another thread.

So, I created this artificial example to check how it works:

fibers = []

Thread.new {
  f = Fiber.new { (1..).each { sleep(0.1) } }
  fibers << f
  f.resume
}
sleep(0.1) # to make sure the thread has started

fibers.last.kill

The example indeed fails with FiberError, but the error message is confusing:

in `kill': attempt to resume a resumed fiber (double resume) (FiberError)

Is this an expected message for such case? Or am I misunderstanding something?

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0