Skip to content

Thread surface: a subclass cannot super into the spawn (2 examples), Thread#backtrace of another thread missing (1) #700

Open

Description

@tannevaled

Two independent Thread surface gaps, measured while fixing the blocking/GVL
defects in #698. Filed together because both are small and were found by the same
work; either can be closed on its own.

1. A Thread subclass cannot super into the spawn — 2 examples

Class.new(Thread) { def initialize; super { puts "ran" }; end }.new
# MRI : runs the block
# rbgo: ThreadError: must be called with a block

Isolated to Thread, not a general super-into-native problem: the same shape
into Array#initialize works on both engines. The cause is structural — rbgo puts
the spawn in Thread.new (a singleton method) where MRI puts it in
Thread#initialize, so a subclass overriding #initialize and calling super
reaches something that no longer carries the block.

Measurement: core/thread/new_spec.rb scores 6 against 8 for MRI 4.0.5 through our
own shim. Owning file internal/vm/thread.go. A fix means moving to
allocate-then-initialize, which is why #698 deliberately did not attempt it
alongside five behavioural fixes.

2. Thread#backtrace of another thread is unimplemented — 1 example

Costs core/conditionvariable/wait_spec.rb 6 against MRI's 7. Owning file
internal/vm/exception.go:522.

Why these are worth filing rather than leaving in a PR body

Both were named only in #698's report. A defect recorded in a PR body stops being
tracked the moment that PR merges, and three examples with a named owning file and
a one-line reproducer is exactly the shape that gets picked up by a later wave. The
same applies to two pre-existing sweep flakes measured in the same work, recorded
here so they are not re-diagnosed as regressions:

That second one matters for the floor: it means a floor set with a margin of 0 or 1
over the measured total will go red on a flake. The ratchet's
UPDATE_FLOOR=1 writes the measured total exactly, so anyone using it should leave
a margin for this or fix the flake first.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions