k0kubun / hamlit

High Performance Haml Implementation
https://rubygems.org/gems/hamlit
Other
980 stars 60 forks source link

Another GC.compact crash in build #177

Closed stanhu closed 3 years ago

stanhu commented 3 years ago

We upgraded to hamlit to v2.14.2 for https://github.com/k0kubun/hamlit/pull/172, but now when we enabled GC.compact, we see a different seg fault:

/opt/gitlab/embedded/service/gitlab-rails/app/views/layouts/_loading_hints.html.haml:7: [BUG] Segmentation fault at 0x0000000000000018
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0243 p:---- s:1636 e:001635 CFUNC  :build
c:0242 p:0332 s:1626 e:001623 METHOD /opt/gitlab/embedded/service/gitlab-rails/app/views/layouts/_loading_hints.html.haml:7
c:0241 p:0038 s:1618 e:001617 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/base.rb:274
c:0240 p:0023 s:1606 e:001605 BLOCK  /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/template.rb:185
c:0239 p:0034 s:1603 e:001602 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:182
c:0238 p:0024 s:1597 e:001596 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/template.rb:385
c:0237 p:0021 s:1592 e:001591 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/template.rb:183
c:0236 p:0088 s:1583 e:001582 BLOCK  /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/renderer/partial_renderer.rb:357
c:0235 p:0005 s:1573 e:001572 BLOCK  /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/renderer/abstract_renderer.rb:88
c:0234 p:0010 s:1569 e:001568 BLOCK  /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180
c:0233 p:0022 s:1566 e:001565 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/notifications/instrumenter.rb:24
c:0232 p:0023 s:1558 e:001557 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180
c:0231 p:0037 s:1552 e:001551 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/renderer/abstract_renderer.rb:87
c:0230 p:0010 s:1546 e:001545 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/renderer/partial_renderer.rb:346
c:0229 p:0155 s:1540 e:001539 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/renderer/partial_renderer.rb:317
c:0228 p:0023 s:1531 e:001530 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/renderer/renderer.rb:65
c:0227 p:0011 s:1524 e:001523 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/renderer/renderer.rb:53
c:0226 p:0039 s:1517 e:001516 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/helpers/rendering_helper.rb:38
c:0225 p:0059 s:1510 e:001509 METHOD /opt/gitlab/embedded/service/gitlab-rails/app/views/layouts/_head.html.haml:6
c:0224 p:0038 s:1469 e:001468 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/base.rb:274
c:0223 p:0023 s:1457 e:001456 BLOCK  /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/template.rb:185
<snip>

-- Control frame information -----------------------------------------------
c:0243 p:---- s:1636 e:001635 CFUNC  :build
c:0242 p:0332 s:1626 e:001623 METHOD /opt/gitlab/embedded/service/gitlab-rails/app/views/layouts/_loading_hints.html.haml:7
c:0241 p:0038 s:1618 e:001617 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/base.rb:274
c:0240 p:0023 s:1606 e:001605 BLOCK  /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/actionview-6.0.3.4/lib/action_view/template.rb:185
c:0239 p:0034 s:1603 e:001602 METHOD /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:182
-- Machine register context ------------------------------------------------
 RIP: 0x00007f8177366604 RBP: 0x00007f8154e3ff00 RSP: 0x00007f8154e3fea8
 RAX: 0x6f745f7374736575 RBX: 0x00007f81687656b0 RCX: 0x0000000000000005
 RDX: 0x0000000000000004 RDI: 0x00007f81687656b0 RSI: 0x000000000009207b
  R8: 0x0000000020910865  R9: 0x0000000000000001 R10: 0x00000000000006ba
 R11: 0x00007f8177368010 R12: 0x000000000009207b R13: 0x00007f81687656b0
 R14: 0x00007f8154e3fec8 R15: 0x0000000000000000 EFL: 0x0000000000010246

-- C level backtrace information -------------------------------------------
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_bugreport+0x54f) [0x7f817739219f] vm_dump.c:755
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_bug_for_fatal_signal+0xdd) [0x7f81771c606d] error.c:660
/opt/gitlab/embedded/lib/libruby.so.2.7(sigsegv+0x52) [0x7f81772f9932] signal.c:946
/lib/x86_64-linux-gnu/libc.so.6(0x7f8176d6a4c0) [0x7f8176d6a4c0]
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_const_lookup+0x4) [0x7f8177366604] variable.c:3354
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_const_get+0x39) [0x7f8177368049] variable.c:2339
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/hamlit-2.14.2/lib/hamlit/hamlit.so(is_boolean_attribute+0xbd) [0x7f8163b459fd] hamlit.c:351
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/hamlit-2.14.2/lib/hamlit/hamlit.so(is_boolean_attribute) (null):0
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/hamlit-2.14.2/lib/hamlit/hamlit.so(rb_hamlit_build+0x1ec) [0x7f8163b460cc] hamlit.c:442
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call_cfunc+0x135) [0x7f817736f3f5] vm_insnhelper.c:2514
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call_method+0x103) [0x7f81773895a3] vm_insnhelper.c:3057
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_exec_core+0xfd) [0x7f817737acbd] vm_insnhelper.c:4023
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_exec+0x9f) [0x7f8177380ccf] vm.c:1920
/opt/gitlab/embedded/lib/libruby.so.2.7(invoke_block_from_c_bh+0x28a) [0x7f8177381bfa] vm.c:1116
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_yield_values2+0x56) [0x7f8177382416] vm.c:1179
/opt/gitlab/embedded/lib/libruby.so.2.7(each_pair_i_fast+0x1e) [0x7f81771f220e] hash.c:3062
/opt/gitlab/embedded/lib/libruby.so.2.7(hash_foreach_call+0xab) [0x7f81771f403b] hash.c:1337
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_ensure+0xd2) [0x7f81771d0ca2] eval.c:1129
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_hash_foreach+0x9c) [0x7f81771f832c] hash.c:1509
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_hash_each_pair+0x30) [0x7f81771f8e90] hash.c:3093
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call_cfunc+0x135) [0x7f817736f3f5] vm_insnhelper.c:2514
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call_method+0x103) [0x7f81773895a3] vm_insnhelper.c:3057
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_exec_core+0xc39) [0x7f817737b7f9] vm_insnhelper.c:4023
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_exec+0x920) [0x7f8177381550] vm.c:1929
/opt/gitlab/embedded/lib/libruby.so.2.7(invoke_block_from_c_bh+0x28a) [0x7f8177381bfa] vm.c:1116
/opt/gitlab/embedded/lib/libruby.so.2.7(yield_under+0x1f9) [0x7f8177382049] vm.c:1171
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call_cfunc+0x135) [0x7f817736f3f5] vm_insnhelper.c:2514
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call_method+0x103) [0x7f81773895a3] vm_insnhelper.c:3057
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call_opt_send+0x221) [0x7f8177389ac1] vm_insnhelper.c:2661
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_exec_core+0xc39) [0x7f817737b7f9] vm_insnhelper.c:4023
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_exec+0x9f) [0x7f8177380ccf] vm.c:1920
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_yield+0x2f1) [0x7f817738be81] vm.c:1044
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_array_len+0x0) [0x7f8177135a5e] array.c:2135
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_ary_each) array.c:2134
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call_cfunc+0x135) [0x7f817736f3f5] vm_insnhelper.c:2514
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_exec_core+0xc39) [0x7f817737b7f9] vm_insnhelper.c:4023
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_exec+0x9f) [0x7f8177380ccf] vm.c:1920
/opt/gitlab/embedded/lib/libruby.so.2.7(catch_i+0x2e1) [0x7f817738ba41] vm.c:1044
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_catch_protect+0xaa) [0x7f817737470a] vm_eval.c:2310
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_catch_obj+0x1f) [0x7f817737481f] vm_eval.c:2336
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call_cfunc+0x135) [0x7f817736f3f5] vm_insnhelper.c:2514
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_exec_core+0xc39) [0x7f817737b7f9] vm_insnhelper.c:4023
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_exec+0x920) [0x7f8177381550] vm.c:1929
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call0_body+0x1cc) [0x7f8177383cbc] vm_eval.c:136
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_call0+0xb4) [0x7f81773844c4] vm_eval.c:52
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_call_kw+0x57) [0x7f8177384767] vm_eval.c:268
/opt/gitlab/embedded/lib/libruby.so.2.7(send_internal+0x12d) [0x7f8177384e0d] vm_eval.c:1135
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_f_public_send+0x51) [0x7f8177384fd1] vm_eval.c:1158
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call_cfunc+0x135) [0x7f817736f3f5] vm_insnhelper.c:2514
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_exec_core+0xc39) [0x7f817737b7f9] vm_insnhelper.c:4023
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_exec+0x9f) [0x7f8177380ccf] vm.c:1920
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_yield+0x2f1) [0x7f817738be81] vm.c:1044
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_array_len+0x0) [0x7f8177135a5e] array.c:2135
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_ary_each) array.c:2134
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call_cfunc+0x135) [0x7f817736f3f5] vm_insnhelper.c:2514
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_exec_core+0xc39) [0x7f817737b7f9] vm_insnhelper.c:4023
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_exec+0x9f) [0x7f8177380ccf] vm.c:1920
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call0_body+0x1cc) [0x7f8177383cbc] vm_eval.c:136
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_call0+0xb4) [0x7f81773844c4] vm_eval.c:52
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_call_kw+0x57) [0x7f8177384767] vm_eval.c:268
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_method_call_with_block_kw+0x76) [0x7f81772a2146] proc.c:2291
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_yield_with_cfunc+0x11a) [0x7f81773771aa] vm_insnhelper.c:3220
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_invoke_block_opt_call+0x3ca) [0x7f81773775ba] vm_insnhelper.c:3381
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_call_method+0x103) [0x7f81773895a3] vm_insnhelper.c:3057
/opt/gitlab/embedded/lib/libruby.so.2.7(vm_exec_core+0xfd) [0x7f817737acbd] vm_insnhelper.c:4023
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_exec+0x9f) [0x7f8177380ccf] vm.c:1920
/opt/gitlab/embedded/lib/libruby.so.2.7(rb_vm_invoke_proc+0x2bd) [0x7f817738398d] vm.c:1116
/opt/gitlab/embedded/lib/libruby.so.2.7(thread_do_start+0x16f) [0x7f817733c3ef] thread.c:697
/opt/gitlab/embedded/lib/libruby.so.2.7(thread_start_func_2+0x26e) [0x7f817733ec7e] thread.c:745
/opt/gitlab/embedded/lib/libruby.so.2.7(thread_start_func_1+0xe7) [0x7f817733f317] thread_pthread.c:969
/lib/x86_64-linux-gnu/libpthread.so.0(start_thread+0xca) [0x7f817607a6ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f8176e3c4dd] ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Do we have to mark id_boolean_attributes?

k0kubun commented 3 years ago

Like before, I eliminated the rb_const_get call which causes the SEGV. Please try v2.14.4.

stanhu commented 3 years ago

@k0kubun Thanks for the fast response!