Project

General

Profile

Actions

Bug #20061

closed

test_free_on_exit_env_var failed with some cppflags

Added by znz (Kazuhiro NISHIYAMA) 6 months ago. Updated 6 months ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.0dev (2023-12-12T01:31:37Z master 73b43fffa1) [x86_64-linux]
[ruby-core:115713]

Description

I use following cppflags, and TestRubyOptions#test_free_on_exit_env_var failed.

../configure 'cppflags=-DUSE_RVARGC -DRUBY_DEBUG -DVM_CHECK_MODE=1 -DTRANSIENT_HEAP_CHECK_MODE -DRGENGC_CHECK_MODE -DENC_DEBUG -DUSE_RUBY_DEBUG_LOG=1' --prefix=$(rbenv root)/versions/master --with-baseruby=/usr/bin/ruby --disable-install-doc

It can reproduce using miniruby.

$ env RUBY_FREE_ON_EXIT=1 ./miniruby -e 0
./miniruby: warning: Free on exit is experimental and may be unstable
-e: [BUG] obj_free: RVALUE_MARKED(0x00007efe26a69010 [3LM    ] T_CLASS (anon)) != FALSE
ruby 3.3.0dev (2023-12-12T01:31:37Z master 73b43fffa1) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0001 p:0000 s:0003 E:0006b0 DUMMY  [FINISH]


-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1

-- C level backtrace information -------------------------------------------
/home/ubuntu/ruby/build/miniruby(rb_print_backtrace+0x14) [0x5563381d66a7] ../vm_dump.c:820
/home/ubuntu/ruby/build/miniruby(rb_vm_bugreport) ../vm_dump.c:1151
/home/ubuntu/ruby/build/miniruby(bug_report_end+0x0) [0x556337fc41ad] ../error.c:1042
/home/ubuntu/ruby/build/miniruby(rb_bug_without_die) ../error.c:1042
/home/ubuntu/ruby/build/miniruby(die+0x0) [0x556337eef35b] ../error.c:1050
/home/ubuntu/ruby/build/miniruby(rb_bug) ../error.c:1052
/home/ubuntu/ruby/build/miniruby(obj_free+0x6db) [0x556337fed3fb] ../gc.c:3551
/home/ubuntu/ruby/build/miniruby(rb_objspace_call_finalizer+0x3bb) [0x556337fed8db] ../gc.c:4692
/home/ubuntu/ruby/build/miniruby(rb_ec_finalize+0x2a) [0x556337fccf80] ../eval.c:168
/home/ubuntu/ruby/build/miniruby(rb_ec_cleanup) ../eval.c:260
/home/ubuntu/ruby/build/miniruby(ruby_run_node+0x6e) [0x556337fcf58e] ../eval.c:328
/home/ubuntu/ruby/build/miniruby(rb_main+0x21) [0x556337f0ff0b] ../main.c:39
/home/ubuntu/ruby/build/miniruby(main) ../main.c:58
/lib/x86_64-linux-gnu/libc.so.6(0x7efe2a5bad90) [0x7efe2a5bad90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7efe2a5bae40]
[0x556337f0ff55]

-- Other runtime information -----------------------------------------------

* Process memory map:

556337ea6000-556337ee9000 r--p 00000000 00:39 4234136                    /home/ubuntu/ruby/build/miniruby
556337ee9000-5563382fc000 r-xp 00043000 00:39 4234136                    /home/ubuntu/ruby/build/miniruby
5563382fc000-5563384aa000 r--p 00456000 00:39 4234136                    /home/ubuntu/ruby/build/miniruby
5563384aa000-5563384c1000 r--p 00603000 00:39 4234136                    /home/ubuntu/ruby/build/miniruby
5563384c1000-5563384c2000 rw-p 0061a000 00:39 4234136                    /home/ubuntu/ruby/build/miniruby
5563384c2000-5563384d8000 rw-p 00000000 00:00 0 
55633a3d2000-55633a6dd000 rw-p 00000000 00:00 0                          [heap]
7efe23be1000-7efe26710000 r--s 00000000 00:39 4234136                    /home/ubuntu/ruby/build/miniruby
7efe26710000-7efe26720000 rw-p 00000000 00:00 0 
7efe26812000-7efe26a30000 r--s 00000000 00:39 4191832                    /usr/lib/x86_64-linux-gnu/libc.so.6
7efe26a30000-7efe26ad0000 rw-p 00000000 00:00 0 
7efe26ad0000-7efe26ad1000 ---p 00000000 00:00 0 
7efe26ad1000-7efe26b72000 rw-p 00000000 00:00 0 
7efe26b72000-7efe26b73000 ---p 00000000 00:00 0 
7efe26b73000-7efe26c14000 rw-p 00000000 00:00 0 
7efe26c14000-7efe26c15000 ---p 00000000 00:00 0 
7efe26c15000-7efe26cb6000 rw-p 00000000 00:00 0 
7efe26cb6000-7efe26cb7000 ---p 00000000 00:00 0 
7efe26cb7000-7efe26d58000 rw-p 00000000 00:00 0 
7efe26d58000-7efe26d59000 ---p 00000000 00:00 0 
7efe26d59000-7efe26dfa000 rw-p 00000000 00:00 0 
7efe26dfa000-7efe26dfb000 ---p 00000000 00:00 0 
7efe26dfb000-7efe26e9c000 rw-p 00000000 00:00 0 
7efe26e9c000-7efe26e9d000 ---p 00000000 00:00 0 
7efe26e9d000-7efe26f3e000 rw-p 00000000 00:00 0 
7efe26f3e000-7efe26f3f000 ---p 00000000 00:00 0 
7efe26f3f000-7efe26fe0000 rw-p 00000000 00:00 0 
7efe26fe0000-7efe26fe1000 ---p 00000000 00:00 0 
7efe26fe1000-7efe27082000 rw-p 00000000 00:00 0 
7efe27082000-7efe27083000 ---p 00000000 00:00 0 
7efe27083000-7efe27124000 rw-p 00000000 00:00 0 
7efe27124000-7efe27125000 ---p 00000000 00:00 0 
7efe27125000-7efe271c6000 rw-p 00000000 00:00 0 
7efe271c6000-7efe271c7000 ---p 00000000 00:00 0 
7efe271c7000-7efe27268000 rw-p 00000000 00:00 0 
7efe27268000-7efe27269000 ---p 00000000 00:00 0 
7efe27269000-7efe2730a000 rw-p 00000000 00:00 0 
7efe2730a000-7efe2730b000 ---p 00000000 00:00 0 
7efe2730b000-7efe273ac000 rw-p 00000000 00:00 0 
7efe273ac000-7efe273ad000 ---p 00000000 00:00 0 
7efe273ad000-7efe2744e000 rw-p 00000000 00:00 0 
7efe2744e000-7efe2744f000 ---p 00000000 00:00 0 
7efe2744f000-7efe274f0000 rw-p 00000000 00:00 0 
7efe274f0000-7efe274f1000 ---p 00000000 00:00 0 
7efe274f1000-7efe27592000 rw-p 00000000 00:00 0 
7efe27592000-7efe27593000 ---p 00000000 00:00 0 
7efe27593000-7efe27634000 rw-p 00000000 00:00 0 
7efe27634000-7efe27635000 ---p 00000000 00:00 0 
7efe27635000-7efe276d6000 rw-p 00000000 00:00 0 
7efe276d6000-7efe276d7000 ---p 00000000 00:00 0 
7efe276d7000-7efe27778000 rw-p 00000000 00:00 0 
7efe27778000-7efe27779000 ---p 00000000 00:00 0 
7efe27779000-7efe2781a000 rw-p 00000000 00:00 0 
7efe2781a000-7efe2781b000 ---p 00000000 00:00 0 
7efe2781b000-7efe278bc000 rw-p 00000000 00:00 0 
7efe278bc000-7efe278bd000 ---p 00000000 00:00 0 
7efe278bd000-7efe2795e000 rw-p 00000000 00:00 0 
7efe2795e000-7efe2795f000 ---p 00000000 00:00 0 
7efe2795f000-7efe27a00000 rw-p 00000000 00:00 0 
7efe27a00000-7efe27a01000 ---p 00000000 00:00 0 
7efe27a01000-7efe27aa2000 rw-p 00000000 00:00 0 
7efe27aa2000-7efe27aa3000 ---p 00000000 00:00 0 
7efe27aa3000-7efe27b44000 rw-p 00000000 00:00 0 
7efe27b44000-7efe27b45000 ---p 00000000 00:00 0 
7efe27b45000-7efe27be6000 rw-p 00000000 00:00 0 
7efe27be6000-7efe27be7000 ---p 00000000 00:00 0 
7efe27be7000-7efe27c88000 rw-p 00000000 00:00 0 
7efe27c88000-7efe27c89000 ---p 00000000 00:00 0 
7efe27c89000-7efe27d2a000 rw-p 00000000 00:00 0 
7efe27d2a000-7efe27d2b000 ---p 00000000 00:00 0 
7efe27d2b000-7efe27dcc000 rw-p 00000000 00:00 0 
7efe27dcc000-7efe27dcd000 ---p 00000000 00:00 0 
7efe27dcd000-7efe27e6e000 rw-p 00000000 00:00 0 
7efe27e6e000-7efe27e6f000 ---p 00000000 00:00 0 
7efe27e6f000-7efe27f20000 rw-p 00000000 00:00 0 
7efe27f2f000-7efe27f30000 ---p 00000000 00:00 0 
7efe27f30000-7efe28780000 rw-p 00000000 00:00 0 
7efe2878f000-7efe2a140000 rw-p 00000000 00:00 0 
7efe2a144000-7efe2a245000 rw-p 00000000 00:00 0 
7efe2a245000-7efe2a24c000 r--s 00000000 00:39 4192098                    /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7efe2a24c000-7efe2a2a3000 r--p 00000000 00:39 4193355                    /usr/lib/locale/C.utf8/LC_CTYPE
7efe2a2a3000-7efe2a58c000 r--p 00000000 00:39 4192959                    /usr/lib/locale/locale-archive
7efe2a58c000-7efe2a591000 rw-p 00000000 00:00 0 
7efe2a591000-7efe2a5b9000 r--p 00000000 00:39 4191832                    /usr/lib/x86_64-linux-gnu/libc.so.6
7efe2a5b9000-7efe2a74e000 r-xp 00028000 00:39 4191832                    /usr/lib/x86_64-linux-gnu/libc.so.6
7efe2a74e000-7efe2a7a6000 r--p 001bd000 00:39 4191832                    /usr/lib/x86_64-linux-gnu/libc.so.6
7efe2a7a6000-7efe2a7aa000 r--p 00214000 00:39 4191832                    /usr/lib/x86_64-linux-gnu/libc.so.6
7efe2a7aa000-7efe2a7ac000 rw-p 00218000 00:39 4191832                    /usr/lib/x86_64-linux-gnu/libc.so.6
7efe2a7ac000-7efe2a7b9000 rw-p 00000000 00:00 0 
7efe2a7b9000-7efe2a7bc000 r--p 00000000 00:39 3583519                    /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7efe2a7bc000-7efe2a7d3000 r-xp 00003000 00:39 3583519                    /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7efe2a7d3000-7efe2a7d7000 r--p 0001a000 00:39 3583519                    /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7efe2a7d7000-7efe2a7d8000 r--p 0001d000 00:39 3583519                    /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7efe2a7d8000-7efe2a7d9000 rw-p 0001e000 00:39 3583519                    /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7efe2a7d9000-7efe2a7e7000 r--p 00000000 00:39 4191835                    /usr/lib/x86_64-linux-gnu/libm.so.6
7efe2a7e7000-7efe2a863000 r-xp 0000e000 00:39 4191835                    /usr/lib/x86_64-linux-gnu/libm.so.6
7efe2a863000-7efe2a8be000 r--p 0008a000 00:39 4191835                    /usr/lib/x86_64-linux-gnu/libm.so.6
7efe2a8be000-7efe2a8bf000 r--p 000e4000 00:39 4191835                    /usr/lib/x86_64-linux-gnu/libm.so.6
7efe2a8bf000-7efe2a8c0000 rw-p 000e5000 00:39 4191835                    /usr/lib/x86_64-linux-gnu/libm.so.6
7efe2a8c0000-7efe2a8c2000 r--p 00000000 00:39 12895                      /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7efe2a8c2000-7efe2a8d6000 r-xp 00002000 00:39 12895                      /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7efe2a8d6000-7efe2a8ef000 r--p 00016000 00:39 12895                      /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7efe2a8ef000-7efe2a8f0000 ---p 0002f000 00:39 12895                      /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7efe2a8f0000-7efe2a8f1000 r--p 0002f000 00:39 12895                      /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7efe2a8f1000-7efe2a8f2000 rw-p 00030000 00:39 12895                      /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7efe2a8f2000-7efe2a8fa000 rw-p 00000000 00:00 0 
7efe2a8fa000-7efe2a904000 r--p 00000000 00:39 13002                      /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7efe2a904000-7efe2a963000 r-xp 0000a000 00:39 13002                      /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7efe2a963000-7efe2a97a000 r--p 00069000 00:39 13002                      /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7efe2a97a000-7efe2a97b000 r--p 0007f000 00:39 13002                      /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7efe2a97b000-7efe2a97c000 rw-p 00080000 00:39 13002                      /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7efe2a97c000-7efe2a97e000 r--p 00000000 00:39 13365                      /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7efe2a97e000-7efe2a98f000 r-xp 00002000 00:39 13365                      /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7efe2a98f000-7efe2a995000 r--p 00013000 00:39 13365                      /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7efe2a995000-7efe2a996000 ---p 00019000 00:39 13365                      /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7efe2a996000-7efe2a997000 r--p 00019000 00:39 13365                      /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7efe2a997000-7efe2a998000 rw-p 0001a000 00:39 13365                      /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7efe2a99e000-7efe2a9a0000 rw-p 00000000 00:00 0 
7efe2a9a0000-7efe2a9a2000 r--p 00000000 00:39 4191829                    /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
7efe2a9a2000-7efe2a9cc000 r-xp 00002000 00:39 4191829                    /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
7efe2a9cc000-7efe2a9d7000 r--p 0002c000 00:39 4191829                    /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
7efe2a9d8000-7efe2a9da000 r--p 00037000 00:39 4191829                    /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
7efe2a9da000-7efe2a9dc000 rw-p 00039000 00:39 4191829                    /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
7ffdc11f0000-7ffdc19ef000 rw-p 00000000 00:00 0                          [stack]
7ffdc19f7000-7ffdc19fb000 r--p 00000000 00:00 0                          [vvar]
7ffdc19fb000-7ffdc19fd000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0                  [vsyscall]


Aborted (core dumped)

Updated by peterzhu2118 (Peter Zhu) 6 months ago

Thank you for reporting this bug. I have a fix here: https://github.com/ruby/ruby/pull/9202

Actions #2

Updated by peterzhu2118 (Peter Zhu) 6 months ago

  • Status changed from Open to Closed

Applied in changeset git|f8ddcecbdf34b8d33ed4311b34d498d4ff380a3e.


[Bug #20061] Clear mark bits when rb_free_on_exit

When compiling with cppflags=-DRGENGC_CHECK_MODE, the following crashes:

$ RUBY_FREE_ON_EXIT=1 ./miniruby -e 0
-e: [BUG] obj_free: RVALUE_MARKED(0x0000000103570020 [3LM    ] T_CLASS (anon)) != FALSE

This commit clears the mark bits when rb_free_on_exit is enabled.

Actions

Also available in: Atom PDF

Like0
Like0Like0