summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-04-07 11:32:30 -0700
committerJeremy Evans <code@jeremyevans.net>2021-07-29 09:44:11 -0700
commit87b327efe6c1f456c43b3f105c7a92a5a7effe93 (patch)
tree11c691d62096b0dd5b2d8105a86c947f3943ce55 /gc.c
parentcbecf9c7ba71ef0e844c72c97f85ce4fffb46aa6 (diff)
Do not check pending interrupts when running finalizers
This fixes cases where exceptions raised using Thread#raise are swallowed by finalizers and not delivered to the running thread. This could cause issues with finalizers that rely on pending interrupts, but that case is expected to be rarer. Fixes [Bug #13876] Fixes [Bug #15507] Co-authored-by: Koichi Sasada <ko1@atdot.net>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4366
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index da0f5ff1b2..f6ea4fc6de 100644
--- a/gc.c
+++ b/gc.c
@@ -4088,10 +4088,14 @@ static void
finalize_deferred(rb_objspace_t *objspace)
{
VALUE zombie;
+ rb_execution_context_t *ec = GET_EC();
+ ec->interrupt_mask |= PENDING_INTERRUPT_MASK;
while ((zombie = ATOMIC_VALUE_EXCHANGE(heap_pages_deferred_final, 0)) != 0) {
finalize_list(objspace, zombie);
}
+
+ ec->interrupt_mask &= ~PENDING_INTERRUPT_MASK;
}
static void