Bug #21964
closedFiber stack acquire can expand unnecessarily
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.
Updated by ioquatix (Samuel Williams) 2 days ago
- Description updated (diff)
Updated by ioquatix (Samuel Williams) 2 days ago
- Subject changed from Fiber stack acquire can expand unnecessarily. to Fiber stack acquire can expand unnecessarily
Updated by ioquatix (Samuel Williams) 2 days ago
- Subject changed from Fiber stack acquire can expand unnecessarily to Fiber stack acquire can expand unnecessarily, causing unexpected `FiberError`
Updated by ioquatix (Samuel Williams) 2 days ago
It's worth noting that this is similar to how it's currently handled in io.c: https://github.com/ruby/ruby/blob/4eab86efde9c98e8f51caeb95a0cf25acd7958f6/io.c#L1077-L1085
Updated by ioquatix (Samuel Williams) 1 day ago
- Subject changed from Fiber stack acquire can expand unnecessarily, causing unexpected `FiberError` to Fiber stack acquire can expand unnecessarily
- Description updated (diff)
Updated by Anonymous about 13 hours ago
- Status changed from Open to Closed
Applied in changeset git|7c8762a93f7083566ee6695368da1487fa35fd4e.
Run GC if fiber pool expansion fails. (#16535)
[Bug #21964]