Project

General

Profile

Bug #15377

rails unit tests get core dumped

Added by evex (abdullah samman) 9 days ago. Updated 8 days ago.

Status:
Assigned
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.6.0dev (2018-12-02 trunk 66124)
[ruby-core:90275]

Description

I'm coming from https://github.com/rails/rails/issues/34606#issuecomment-443914170

Basically what happened is that rails Postgres tests started getting core dumped after this commit https://github.com/ruby/ruby/commit/a0e438cd3c28d2eaf4efa18243d5b6edafa14d88 on ruby.

The error says

$ bundle exec rake test_postgresql
Using postgresql

# Running:

...................................................................ruby(52349,0x7fff99d3f380) malloc: *** error for object 0x7fed0f2b6ed0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

and here's a stack-trace for this issue

(lldb) thread backtrace
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 2.1 3.1 4.1 5.1
  * frame #0: 0x00007fff613ef962 libsystem_malloc.dylib`malloc_error_break
    frame #1: 0x00007fff613e17a9 libsystem_malloc.dylib`free + 400
    frame #2: 0x000000010367bf36 libruby.2.6.dylib`ruby_xfree [inlined] objspace_xfree(objspace=0x00007fed1850ddd0, ptr=0x00007fed0f2b6ed0, old_size=0) at gc.c:8313
    frame #3: 0x000000010367bf23 libruby.2.6.dylib`ruby_xfree [inlined] ruby_sized_xfree(x=0x00007fed0f2b6ed0) at gc.c:8409
    frame #4: 0x000000010367bf0d libruby.2.6.dylib`ruby_xfree(x=0x00007fed0f2b6ed0) at gc.c:8416
    frame #5: 0x000000010368bee1 libruby.2.6.dylib`obj_free(objspace=0x00007fed1850ddd0, obj=140656539140320) at gc.c:2328
    frame #6: 0x000000010368ab2c libruby.2.6.dylib`gc_sweep_step [inlined] gc_page_sweep(objspace=<unavailable>, sweep_page=0x00007fed2572e790) at gc.c:3637
    frame #7: 0x000000010368aa42 libruby.2.6.dylib`gc_sweep_step(objspace=<unavailable>, heap=0x00007fed1850ddf0) at gc.c:3806
    frame #8: 0x000000010368205b libruby.2.6.dylib`rb_gc_disable [inlined] gc_sweep_rest(objspace=<unavailable>) at gc.c:3856
    frame #9: 0x0000000103682046 libruby.2.6.dylib`rb_gc_disable [inlined] gc_rest(objspace=0x00007fed1850ddd0) at gc.c:6687
    frame #10: 0x0000000103681fb0 libruby.2.6.dylib`rb_gc_disable at gc.c:7572
    frame #11: 0x00000001037ddf89 libruby.2.6.dylib`transient_heap_evacuate(dmy=<unavailable>) at transient_heap.c:730
    frame #12: 0x000000010381ac06 libruby.2.6.dylib`rb_postponed_job_flush(vm=0x00007fed19000e00) at vm_trace.c:1898
    frame #13: 0x00000001037b965c libruby.2.6.dylib`rb_threadptr_execute_interrupts(th=0x00007fed1850dbb0, blocking_timing=0) at thread.c:2172
    frame #14: 0x00000001037fa31e libruby.2.6.dylib`vm_call0_body [inlined] rb_vm_check_ints(ec=0x00007fed1850e038) at vm_core.h:1808
    frame #15: 0x00000001037fa300 libruby.2.6.dylib`vm_call0_body(ec=0x00007fed1850e038, calling=<unavailable>, ci=<unavailable>, cc=<unavailable>, argv=0x0000000103a28740) at vm_eval.c:200
    frame #16: 0x00000001037f861f libruby.2.6.dylib`rb_funcallv [inlined] rb_vm_call0(ec=<unavailable>, recv=<unavailable>, id=<unavailable>, argc=2, argv=0x0000000103a28740, me=<unavailable>) at vm_eval.c:60
    frame #17: 0x00000001037f85e8 libruby.2.6.dylib`rb_funcallv [inlined] rb_call0(ec=0x00007fed1850e038, recv=140656551148080, mid=3025, argc=2, argv=0x0000000103a28740, scope=CALL_FCALL, self=140656303907640) at vm_eval.c:308
    frame #18: 0x00000001037f8551 libruby.2.6.dylib`rb_funcallv [inlined] rb_call(recv=140656551148080, mid=3025, argc=2, argv=0x0000000103a28740, scope=CALL_FCALL) at vm_eval.c:601
    frame #19: 0x00000001037f8542 libruby.2.6.dylib`rb_funcallv(recv=140656551148080, mid=3025, argc=2, argv=0x0000000103a28740) at vm_eval.c:823
    frame #20: 0x00000001037be407 libruby.2.6.dylib`thread_s_new(argc=2, argv=0x0000000103a28740, klass=140656303907640) at thread.c:877
    frame #21: 0x0000000103808b91 libruby.2.6.dylib`vm_call_cfunc [inlined] vm_call_cfunc_with_frame(ec=<unavailable>, reg_cfp=<unavailable>, ci=0x00007fed1d14ae80) at vm_insnhelper.c:1908
    frame #22: 0x0000000103808aa4 libruby.2.6.dylib`vm_call_cfunc(ec=<unavailable>, reg_cfp=<unavailable>, calling=<unavailable>, ci=0x00007fed1d14ae80, cc=<unavailable>) at vm_insnhelper.c:1924
    frame #23: 0x00000001037efdff libruby.2.6.dylib`vm_exec_core(ec=<unavailable>, initial=<unavailable>) at insns.def:751
    frame #24: 0x000000010380362e libruby.2.6.dylib`rb_vm_exec(ec=0x00007fed1850e038, mjit_enable_p=<unavailable>) at vm.c:0
    frame #25: 0x00000001037f861f libruby.2.6.dylib`rb_funcallv [inlined] rb_vm_call0(ec=<unavailable>, recv=<unavailable>, id=<unavailable>, argc=1, argv=0x0000000103a286c8, me=<unavailable>) at vm_eval.c:60
    frame #26: 0x00000001037f85e8 libruby.2.6.dylib`rb_funcallv [inlined] rb_call0(ec=0x00007fed1850e038, recv=140656551148920, mid=3025, argc=1, argv=0x0000000103a286c8, scope=CALL_FCALL, self=140656295984040) at vm_eval.c:308
    frame #27: 0x00000001037f8551 libruby.2.6.dylib`rb_funcallv [inlined] rb_call(recv=140656551148920, mid=3025, argc=1, argv=0x0000000103a286c8, scope=CALL_FCALL) at vm_eval.c:601
    frame #28: 0x00000001037f8542 libruby.2.6.dylib`rb_funcallv(recv=140656551148920, mid=3025, argc=1, argv=0x0000000103a286c8) at vm_eval.c:823
    frame #29: 0x00000001036f0189 libruby.2.6.dylib`rb_class_s_new(argc=<unavailable>, argv=<unavailable>, klass=<unavailable>) at object.c:2185
    frame #30: 0x0000000103808b91 libruby.2.6.dylib`vm_call_cfunc [inlined] vm_call_cfunc_with_frame(ec=<unavailable>, reg_cfp=<unavailable>, ci=0x00007fed1d1495f0) at vm_insnhelper.c:1908
    frame #31: 0x0000000103808aa4 libruby.2.6.dylib`vm_call_cfunc(ec=<unavailable>, reg_cfp=<unavailable>, calling=<unavailable>, ci=0x00007fed1d1495f0, cc=<unavailable>) at vm_insnhelper.c:1924
    frame #32: 0x00000001037f00af libruby.2.6.dylib`vm_exec_core(ec=<unavailable>, initial=<unavailable>) at insns.def:766
    frame #33: 0x000000010380362e libruby.2.6.dylib`rb_vm_exec(ec=0x00007fed1850e038, mjit_enable_p=<unavailable>) at vm.c:0
    frame #34: 0x00000001037fe812 libruby.2.6.dylib`yield_under [inlined] vm_yield_with_cref(ec=<unavailable>, argc=<unavailable>, argv=0x0000000103a28580) at vm.c:1138
    frame #35: 0x00000001037fe7db libruby.2.6.dylib`yield_under(under=140656551107040, self=<unavailable>, argc=0, argv=0x0000000103a28580) at vm_eval.c:1576
    frame #36: 0x0000000103808b91 libruby.2.6.dylib`vm_call_cfunc [inlined] vm_call_cfunc_with_frame(ec=<unavailable>, reg_cfp=<unavailable>, ci=0x00007ffeec621ca0) at vm_insnhelper.c:1908
    frame #37: 0x0000000103808aa4 libruby.2.6.dylib`vm_call_cfunc(ec=<unavailable>, reg_cfp=<unavailable>, calling=<unavailable>, ci=0x00007ffeec621ca0, cc=<unavailable>) at vm_insnhelper.c:1924
    frame #38: 0x0000000103809a46 libruby.2.6.dylib`vm_call_opt_send(ec=0x00007fed1850e038, reg_cfp=<unavailable>, calling=<unavailable>, orig_ci=<unavailable>, orig_cc=<unavailable>) at vm_insnhelper.c:2037
    frame #39: 0x00000001037efdff libruby.2.6.dylib`vm_exec_core(ec=<unavailable>, initial=<unavailable>) at insns.def:751
    frame #40: 0x000000010380362e libruby.2.6.dylib`rb_vm_exec(ec=0x00007fed1850e038, mjit_enable_p=<unavailable>) at vm.c:0
    frame #41: 0x00000001037fc86e libruby.2.6.dylib`rb_yield [inlined] vm_yield at vm.c:1146
    frame #42: 0x00000001037fc85f libruby.2.6.dylib`rb_yield [inlined] rb_yield_0(argc=0, argv=<unavailable>) at vm_eval.c:978
    frame #43: 0x00000001037fc85f libruby.2.6.dylib`rb_yield(val=<unavailable>) at vm_eval.c:991
    frame #44: 0x00000001035e1599 libruby.2.6.dylib`rb_ary_each(ary=140656539216000) at array.c:2076
    frame #45: 0x0000000103808b91 libruby.2.6.dylib`vm_call_cfunc [inlined] vm_call_cfunc_with_frame(ec=<unavailable>, reg_cfp=<unavailable>, ci=0x00007fed1bb8f9b0) at vm_insnhelper.c:1908
    frame #46: 0x0000000103808aa4 libruby.2.6.dylib`vm_call_cfunc(ec=<unavailable>, reg_cfp=<unavailable>, calling=<unavailable>, ci=0x00007fed1bb8f9b0, cc=<unavailable>) at vm_insnhelper.c:1924
    frame #47: 0x00000001037efdff libruby.2.6.dylib`vm_exec_core(ec=<unavailable>, initial=<unavailable>) at insns.def:751
    frame #48: 0x000000010380362e libruby.2.6.dylib`rb_vm_exec(ec=0x00007fed1850e038, mjit_enable_p=<unavailable>) at vm.c:0
    frame #49: 0x00000001037fc86e libruby.2.6.dylib`rb_yield [inlined] vm_yield at vm.c:1146
    frame #50: 0x00000001037fc85f libruby.2.6.dylib`rb_yield [inlined] rb_yield_0(argc=0, argv=<unavailable>) at vm_eval.c:978
    frame #51: 0x00000001037fc85f libruby.2.6.dylib`rb_yield(val=<unavailable>) at vm_eval.c:991
    frame #52: 0x00000001035e1599 libruby.2.6.dylib`rb_ary_each(ary=140656341693360) at array.c:2076
    frame #53: 0x0000000103808b91 libruby.2.6.dylib`vm_call_cfunc [inlined] vm_call_cfunc_with_frame(ec=<unavailable>, reg_cfp=<unavailable>, ci=0x00007fed1bcb0150) at vm_insnhelper.c:1908
    frame #54: 0x0000000103808aa4 libruby.2.6.dylib`vm_call_cfunc(ec=<unavailable>, reg_cfp=<unavailable>, calling=<unavailable>, ci=0x00007fed1bcb0150, cc=<unavailable>) at vm_insnhelper.c:1924
    frame #55: 0x00000001037efdff libruby.2.6.dylib`vm_exec_core(ec=<unavailable>, initial=<unavailable>) at insns.def:751
    frame #56: 0x000000010380362e libruby.2.6.dylib`rb_vm_exec(ec=0x00007fed1850e038, mjit_enable_p=<unavailable>) at vm.c:0
    frame #57: 0x00000001037fc86e libruby.2.6.dylib`rb_yield [inlined] vm_yield at vm.c:1146
    frame #58: 0x00000001037fc85f libruby.2.6.dylib`rb_yield [inlined] rb_yield_0(argc=0, argv=<unavailable>) at vm_eval.c:978
    frame #59: 0x00000001037fc85f libruby.2.6.dylib`rb_yield(val=<unavailable>) at vm_eval.c:991
    frame #60: 0x00000001035e1599 libruby.2.6.dylib`rb_ary_each(ary=140656521381480) at array.c:2076
    frame #61: 0x0000000103808b91 libruby.2.6.dylib`vm_call_cfunc [inlined] vm_call_cfunc_with_frame(ec=<unavailable>, reg_cfp=<unavailable>, ci=0x00007fed1bc093b0) at vm_insnhelper.c:1908
    frame #62: 0x0000000103808aa4 libruby.2.6.dylib`vm_call_cfunc(ec=<unavailable>, reg_cfp=<unavailable>, calling=<unavailable>, ci=0x00007fed1bc093b0, cc=<unavailable>) at vm_insnhelper.c:1924
    frame #63: 0x00000001037efdff libruby.2.6.dylib`vm_exec_core(ec=<unavailable>, initial=<unavailable>) at insns.def:751
    frame #64: 0x000000010380362e libruby.2.6.dylib`rb_vm_exec(ec=0x00007fed1850e038, mjit_enable_p=<unavailable>) at vm.c:0
    frame #65: 0x00000001037fc86e libruby.2.6.dylib`rb_yield [inlined] vm_yield at vm.c:1146
    frame #66: 0x00000001037fc85f libruby.2.6.dylib`rb_yield [inlined] rb_yield_0(argc=0, argv=<unavailable>) at vm_eval.c:978
    frame #67: 0x00000001037fc85f libruby.2.6.dylib`rb_yield(val=<unavailable>) at vm_eval.c:991
    frame #68: 0x00000001035e7f96 libruby.2.6.dylib`rb_ary_collect(ary=140656309090560) at array.c:3013
    frame #69: 0x0000000103808b91 libruby.2.6.dylib`vm_call_cfunc [inlined] vm_call_cfunc_with_frame(ec=<unavailable>, reg_cfp=<unavailable>, ci=0x00007fed1bc2dc90) at vm_insnhelper.c:1908
    frame #70: 0x0000000103808aa4 libruby.2.6.dylib`vm_call_cfunc(ec=<unavailable>, reg_cfp=<unavailable>, calling=<unavailable>, ci=0x00007fed1bc2dc90, cc=<unavailable>) at vm_insnhelper.c:1924
    frame #71: 0x00000001037efdff libruby.2.6.dylib`vm_exec_core(ec=<unavailable>, initial=<unavailable>) at insns.def:751
    frame #72: 0x000000010380362e libruby.2.6.dylib`rb_vm_exec(ec=0x00007fed1850e038, mjit_enable_p=<unavailable>) at vm.c:0
    frame #73: 0x000000010371e298 libruby.2.6.dylib`rb_proc_call(self=<unavailable>, args=<unavailable>) at proc.c:881
    frame #74: 0x000000010366c602 libruby.2.6.dylib`rb_exec_end_proc [inlined] exec_end_procs_chain(errp=0x00007fed1850e0b0) at eval_jump.c:105
    frame #75: 0x000000010366c5a9 libruby.2.6.dylib`rb_exec_end_proc at eval_jump.c:121
    frame #76: 0x000000010366cc2e libruby.2.6.dylib`ruby_finalize_0 at eval.c:137
    frame #77: 0x000000010366cda3 libruby.2.6.dylib`ruby_cleanup(ex=0) at eval.c:194
    frame #78: 0x000000010366d0a0 libruby.2.6.dylib`ruby_run_node(n=<unavailable>) at eval.c:317
    frame #79: 0x00000001035d8ee1 ruby`main(argc=<unavailable>, argv=<unavailable>) at main.c:42
    frame #80: 0x00007fff61237015 libdyld.dylib`start + 1

Repro steps:

rvm install ruby-head
git clone https://github.com/rails/rails.git
cd rails
bundle
cd activerecord
bundle exec rake test_postgresql

How can we fix this issue?

History

#1 [ruby-core:90276] Updated by ko1 (Koichi Sasada) 9 days ago

Hi,

I want to reproduce it, but I got the following error.

/home/ko1/ruby/tmp/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:50:in `rescue in postgresql_connection': FATAL: database "activerecord_unittest" does not exist (ActiveRecord::NoDatabaseError)

Could you help me?

#2 [ruby-core:90277] Updated by yahonda (Yasuo Honda) 9 days ago

You can create "activerecord_unittest" database by running this command below:

$ cd activerecord
$ bundle exec rake db:postgresql:build

#4 [ruby-core:90279] Updated by ko1 (Koichi Sasada) 9 days ago

all right,
I read https://guides.rubyonrails.org/development_dependencies_install.html#mysql-and-postgresql (thanks Kaneko-san) and I make my username superuser.

I got same critical failure.

Thank you!

#5 [ruby-core:90280] Updated by evex (abdullah samman) 9 days ago

ko1 (Koichi Sasada) wrote:

I got same critical failure.

Can you follow solutions here: https://stackoverflow.com/questions/22135792/permission-denied-to-create-extension-uuid-ossp

It's the same issue in that thread.

#6 [ruby-core:90293] Updated by ko1 (Koichi Sasada) 8 days ago

  • Assignee set to mrkn (Kenta Murata)
  • Status changed from Open to Assigned

I mean "critical failure" is your issue (double free).
I could reproduce it. And it seems BigDecimal issue.

If you find more shorter reproducing process, it will help us.

Thanks,
Koichi

#7 [ruby-core:90297] Updated by ko1 (Koichi Sasada) 8 days ago

Now recent BigDecimal changes were reverted, and I passed tests now.

Finished in 448.578323s, 15.3998 runs/s, 40.4946 assertions/s.
6908 runs, 18165 assertions, 0 failures, 0 errors, 2 skips

mrkn will fix this issue and will re-introduce them.

#8 [ruby-core:90303] Updated by evex (abdullah samman) 8 days ago

ko1 (Koichi Sasada) wrote:

Now recent BigDecimal changes were reverted, and I passed tests now.

Finished in 448.578323s, 15.3998 runs/s, 40.4946 assertions/s.
6908 runs, 18165 assertions, 0 failures, 0 errors, 2 skips

mrkn will fix this issue and will re-introduce them.

Great! thanks :)

Also available in: Atom PDF