From: KitaitiMakoto via ruby-core <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: KitaitiMakoto <noreply@ruby-lang.org>
Subject: [ruby-core:120408] [Ruby master Bug#20981] rb_undefine_finalizer is missing
Date: Wed, 25 Dec 2024 14:27:59 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-111188.20241225142756.55443@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-20981.20241225115324.55443@ruby-lang.org>
Issue #20981 has been updated by KitaitiMakoto (真 北市).
Thank you! I confirmed my code works fine in Ruby `master` branch.
----------------------------------------
Bug #20981: rb_undefine_finalizer is missing
https://bugs.ruby-lang.org/issues/20981#change-111188
* Author: KitaitiMakoto (真 北市)
* Status: Closed
* ruby -v: 3.4.1
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED
----------------------------------------
Merry Christmas!
I encountered an error like "dyld[89037]: missing symbol called" in an extension which uses`rb_undefine_finalizer` in Ruby 3.4.1. It works fine in Ruby 3.3.6.
The function defined in [ruby/include/ruby/internal/gc.h](https://github.com/ruby/ruby/blob/v3_4_1/include/ruby/internal/gc.h#L315-L326) but seems removed from [ruby/gc.c](https://github.com/ruby/ruby/blob/v3_4_1/gc.c). Could you consider restore the implementation or remove the function from `gc.h`?
Reproducible code:
### extconf.rb ###
```ruby
require "mkmf"
create_makefile "undefine_finalizer_bug"
```
### undefine_finalizer_bug.c ###
```c
#include<ruby.h>
static VALUE s_undefine_finalizer(VALUE self) {
rb_undefine_finalizer(self);
return Qnil;
}
void Init_undefine_finalizer_bug(void) {
VALUE klass = rb_define_class("UndefineFinalizerBug", rb_cObject);
rb_define_singleton_method(klass, "undefine_finalizer", s_undefine_finalizer, 0);
}
```
### undefine-finalizer-bug.rb ###
```ruby
require "undefine_finalizer_bug.so"
finalizer = proc {
puts "Finalizer called"
}
ObjectSpace.define_finalizer(UndefineFinalizerBug, finalizer)
UndefineFinalizerBug.new
UndefineFinalizerBug.undefine_finalizer
GC.start
```
### Running ###
#### Ruby 3.4.1 ##
```
% ruby ./extconf.rb && make && ruby -v -I. ./undefine-finalizer-bug.rb
creating Makefile
linking shared-object undefine_finalizer_bug.bundle
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [arm64-darwin24]
dyld[2436]: missing symbol called
[1] 2436 abort ruby -v -I. ./undefine-finalizer-bug.rb
```
#### Ruby 3.3.6 ####
```
% chruby-exec 3.3.6 -- ruby ./extconf.rb && make && chruby-exec 3.3.6 -- ruby -v -I. ./undefine-finalizer-bug.rb
creating Makefile
linking shared-object undefine_finalizer_bug.bundle
ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [arm64-darwin24]
```
Thank you.
--
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/
next prev parent reply other threads:[~2024-12-25 14:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-25 11:53 [ruby-core:120404] " KitaitiMakoto via ruby-core
2024-12-25 13:17 ` [ruby-core:120406] " nobu (Nobuyoshi Nakada) via ruby-core
2024-12-25 13:28 ` [ruby-core:120407] " nobu (Nobuyoshi Nakada) via ruby-core
2024-12-25 14:27 ` KitaitiMakoto via ruby-core [this message]
2025-02-14 1:48 ` [ruby-core:121001] " k0kubun (Takashi Kokubun) via ruby-core
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-111188.20241225142756.55443@ruby-lang.org \
--to=ruby-core@ml.ruby-lang.org \
--cc=noreply@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).