From: "luke-gru (Luke Gruber) via ruby-core" Date: 2026-06-09T21:37:12+00:00 Subject: [ruby-core:125655] [Ruby Bug#22098] Reconsider whether THREAD_EVENT_RESUMED runs with GVL held Issue #22098 has been updated by luke-gru (Luke Gruber). It really depends on what "having the GVL" means. Right now, `ruby_thread_has_gvl_p()` can return `false` in hooks for this event. This is what can cause a deadlock. ---------------------------------------- Bug #22098: Reconsider whether THREAD_EVENT_RESUMED runs with GVL held https://bugs.ruby-lang.org/issues/22098#change-117514 * Author: luke-gru (Luke Gruber) * Status: Open * Assignee: luke-gru (Luke Gruber) * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- Today, it's possible to get a deadlock when allocating during a hook for this event. I attached a reproduction script using the `gvltools` gem. One way to fix it would be to not allocate during this hook and change the documentation to be clear that the GVL is not held. Any gems relying on this behavior, like `gvltools`, would need to be patched. Another way to approach it would be to change the call site for this hook invocation. I believe it would need to be added to quite a few places. To maintain Ractor safety, it would also need to be invoked without any locks held. I'm curious about your thoughts @byroot. ---Files-------------------------------- repro.rb (3.11 KB) run_loop.sh (2.82 KB) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/