Project

General

Profile

Actions

Feature #22139

open

Prohibit `END{}`/`Kernel#at_exit` in non-main Ractor

Feature #22139: Prohibit `END{}`/`Kernel#at_exit` in non-main Ractor

Added by ko1 (Koichi Sasada) 1 day ago. Updated 1 day ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:125903]

Description

Let's prohibit END{}/Kernel#at_exit on non-main Ractor.

The current behavior is strange:

Ractor.new{
  at_exit{ p [self, Ractor.current] }
}

sleep 1
#=> [#<Ractor:#2 t.rb:2 terminated>, #<Ractor:#1 running>]

There are some options:

  1. prohibit them. Simple.
  2. invoke the block at the end of the Ractor.
  3. invoke the block at the end of the process on main Ractor. It is similar idea of the current behavior.

2 is rejected clearly by Matz because of the semantic gap with current behavior.
3 is no problem because the block and reachable objects from the block can be inherited to main Ractor.
However, to make it simple, now let's prohibit them (1), and revisit if we found the (3) is needed.

Actions

Also available in: PDF Atom