For completeness, I'm attaching a threaded repro that fails reliably on `miniruby`. The interesting part is it shows this can happen with regular code accessing a Hash from different threads and without needing to override or do anythin...Eregon (Benoit Daloze)
While perusing code in hash.c (motivated by some crashes reported in https://github.com/DataDog/dd-trace-rb/issues/5718), I found it suspicious that `ar_find_entry_hint()` didn't reread `bound` in the loop and yet called arbitrary code ...Eregon (Benoit Daloze)
Some more context from Claude on `RUBY_INTERNAL_THREAD_EVENT_STARTED`: > Ruby 3.2: STARTED fires in thread_start_func_1 (thread_pthread.c:1166) — this runs on the new thread itself, without the > ... > the GVL as documented; from 3.3...Eregon (Benoit Daloze)
From https://github.com/ruby/ruby/blob/c2879d4eb1c2f232c893656a49a2c53353aebf04/include/ruby/thread.h#L219-L252 ```c /** * Triggered when a new thread is started. * * @note The callback will be called *without* the GVL held...Eregon (Benoit Daloze)
mame (Yusuke Endoh) wrote in #note-43: > By the way, this did not come up during the meeting, but I think the fact that `RSTRING_PTR` can now trigger GC could itself be a serious compatibility problem. There is probably a fair amount of ...Eregon (Benoit Daloze)
jhawthorn (John Hawthorn) wrote in #note-14: > Why do you need it? Could you pass the raw pointer? In this case it's to access some configuration of the profiler for whether to sample after RESUMED (`state->waiting_for_gvl_threshold_...Eregon (Benoit Daloze)
One reason it would be valuable to be able to allocate in RESUMED is that's a good spot to set the per-thread state. I looked at the datadog gem, gvltools, gvl-tracing and vernier. All of them except vernier use `rb_internal_thread_spec...Eregon (Benoit Daloze)
jhawthorn (John Hawthorn) wrote in #note-12: > I feel very strongly that we must not allow arbitrary Ruby code in these hooks. I agree, I expressed that poorly. I meant to say one would expect the GVL is held (given the name of the hook...Eregon (Benoit Daloze)
Since the performance relies on having `with_refinements` called always with the same Refinement module for a given block, how about raising an exception if it doesn't hold? Then we effectively have a guarantee vs very slow performance f...Eregon (Benoit Daloze)
jhawthorn (John Hawthorn) wrote in #note-7: > we could adjust the documentation to say "about to acquire the GVL" or "has exclusive hold on the GVL, but hasn't yet fully acquired it" This sounds pretty weird (to me at least) because int...Eregon (Benoit Daloze)