Project

General

Profile

Actions

Bug #21964

closed

Fiber stack acquire can expand unnecessarily

Bug #21964: Fiber stack acquire can expand unnecessarily

Added by ioquatix (Samuel Williams) 2 days ago. Updated about 13 hours ago.


Description

In several common scenarios, the fiber stack allocator can choose to expand the fiber stack pool even when there are unreachable (effectively dead) fibers.

For example, the following program will eventually crash if GC does not run in time:

loop do
  Fiber.new{Fiber.yield}.resume
end

We have a loop that resumes a fiber, that fiber yields, and then becomes unreachable. Eventually, we will exhaust the OS vm map limit and fail with FiberError. However, at most only one fiber (stack) is needed to execute the above program, since the fiber immediately becomes unreachable.

To fix this, we need to run GC on expansion failure: https://github.com/ruby/ruby/pull/16535.

Actions

Also available in: PDF Atom