Project

General

Profile

Actions

Bug #4123

closed

thread-safe problem in libxml_ruby.so

Added by tracy_trend (tracy qin) over 13 years ago. Updated almost 13 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
ruby -v:
1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]
Backport:
[ruby-core:33592]

Description

=begin
Hi,

We set up a rails webservice app using libxml_ruby.so, Hash.from_xml funtion.
This Webserive server works as one process and start new thread to handle each request. But crash always happens at the second call.

rails reported stacktrace as below: (also attached as "libxml_AbortStacktrace.txt"

-- Ruby level backtrace information ----------------------------------------
/usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in block in start_thread' /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in run'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in service' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/handler/webrick.rb:50:in service'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/content_length.rb:13:in call' /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.4/lib/rails/rack/log_tailer.rb:17:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in call' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in each'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/urlmap.rb:46:in block in call' /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.4/lib/rails/rack/static.rb:31:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:108:in call' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/reloader.rb:34:in run'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:114:in block in call' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/lock.rb:11:in call'
internal:prelude:10:in synchronize' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/lock.rb:11:in block in call'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/failsafe.rb:26:in call' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/session/cookie_store.rb:93:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/params_parser.rb:15:in call' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/methodoverride.rb:24:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/head.rb:9:in call' /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:28:in call' /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:9:in cache'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in cache' /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:29:in block in call'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:29:in call' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:130:in block in build_middleware_stack'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:121:in _call' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:87:in dispatch'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:436:in call' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:443:in recognize'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/core_ext/string/inflections.rb:162:in constantize' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/inflector.rb:371:in constantize'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/inflector.rb:371:in each' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/inflector.rb:372:in block in constantize'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/inflector.rb:372:in const_get' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:80:in const_missing_with_dependencies'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:425:in load_missing_constant' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:259:in require_or_load'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:379:in load_file' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in new_constants_in'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:380:in block in load_file' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:380:in load'
/var/webapps/ws_ui/app/controllers/v20/stats_controller.rb:1:in <top (required)>' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:96:in const_missing'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:425:in load_missing_constant' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:259:in require_or_load'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:379:in load_file' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in new_constants_in'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:380:in block in load_file' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:380:in load'
/var/webapps/ws_ui/app/controllers/application_controller.rb:7:in <top (required)>' /var/webapps/ws_ui/app/controllers/application_controller.rb:9:in class:ApplicationController'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/helpers.rb:115:in helper' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/helpers.rb:115:in each'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/helpers.rb:120:in block in helper' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/helpers.rb:115:in helper'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/helpers.rb:115:in each' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/helpers.rb:126:in block in helper'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:136:in require_dependency' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:224:in depend_on'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:259:in require_or_load' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:373:in load_file'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:312:in loadable_constants_for_path' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:312:in collect'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:313:in block in loadable_constants_for_path' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:313:in expand_path'

-- C level backtrace information -------------------------------------------
ruby(rb_vm_bugreport+0x68) [0x52bc38]
ruby [0x566a01]
ruby(rb_bug+0xee) [0x566b09]
ruby [0x4b3850]
/lib64/libpthread.so.0 [0x2af6da3fab10]
/lib64/libc.so.6 [0x2af6daf40485]
/lib64/libc.so.6 [0x2af6daf42a6c]
/lib64/libc.so.6(__libc_malloc+0x6e) [0x2af6daf44cde]
ruby [0x41e4ae]
ruby(ruby_xmalloc2+0x64) [0x41e68d]
ruby [0x4c005d]
ruby(rb_str_new+0x24) [0x4c02b8]
ruby(rb_usascii_str_new+0x1d) [0x4c02d7]
ruby(rb_file_expand_path+0x40) [0x5702c7]
ruby(rb_file_s_expand_path+0x26) [0x570304]
ruby [0x51f980]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x52763f]
ruby [0x5276c6]
ruby [0x52417f]
ruby(rb_yield+0x39) [0x524153]
ruby [0x540018]
ruby [0x51f998]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x52763f]
ruby [0x5276c6]
ruby [0x52417f]
ruby(rb_yield+0x39) [0x524153]
ruby(rb_ary_each+0x8a) [0x53d736]
ruby [0x51f998]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x52763f]
ruby [0x5276c6]
ruby [0x52417f]
ruby(rb_yield+0x39) [0x524153]
ruby(rb_ary_each+0x8a) [0x53d736]
ruby [0x51f998]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby(rb_iseq_eval+0x2d) [0x529391]
ruby [0x56ad05]
ruby [0x56af4a]
ruby [0x51f980]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x522aaf]
ruby [0x523d7f]
ruby [0x523cd5]
ruby(rb_funcall+0x201) [0x523f8a]
ruby [0x4fb60e]
ruby [0x4fbe1f]
ruby(rb_const_get+0x27) [0x4fbe8d]
ruby [0x51e650]
ruby [0x517741]
ruby [0x5289a5]
ruby(rb_iseq_eval+0x2d) [0x529391]
ruby [0x56ad05]
ruby [0x56af4a]
ruby [0x51f980]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x522aaf]
ruby [0x523d7f]
ruby [0x523cd5]
ruby(rb_funcall+0x201) [0x523f8a]
ruby [0x4fb60e]
ruby [0x4fbe1f]
ruby(rb_const_get_at+0x27) [0x4fbeb6]
ruby [0x44cb0a]
ruby [0x51f980]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x52763f]
ruby [0x5276c6]
ruby [0x52417f]
ruby(rb_yield+0x39) [0x524153]
ruby(rb_ary_each+0x8a) [0x53d736]
ruby [0x51f998]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x52763f]
ruby(rb_vm_invoke_proc+0xfd) [0x5277c5]
ruby [0x41afa1]
ruby [0x51f980]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x52763f]
ruby [0x5276c6]
ruby [0x52417f]
ruby(rb_yield+0x39) [0x524153]
ruby(rb_ary_each+0x8a) [0x53d736]
ruby [0x51f998]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x52763f]
ruby(rb_vm_invoke_proc+0xfd) [0x5277c5]
ruby [0x52cfef]
ruby [0x52c16b]
/lib64/libpthread.so.0 [0x2af6da3f273d]
/lib64/libc.so.6(clone+0x6d) [0x2af6dafa3d1d]

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Aborted (core dumped)

Then we recompile ruby in debug mode and accquire below calldump. (also attached as libxml_coredump.txt)

===============
#0 0x00002b7acf490265 in raise () from /lib64/libc.so.6
#1 0x00002b7acf491d10 in abort () from /lib64/libc.so.6
#2 0x0000000000566b0e in rb_bug (fmt=0x5a70ff "Segmentation fault") at error.c:253
#3 0x00000000004b3850 in sigsegv (sig=11, info=0x1243afd0, ctx=0x1243aea0) at signal.c:613
#4
#5 0x00002b7acf4d1d26 in _int_free () from /lib64/libc.so.6
#6 0x00002b7acf4d276b in free () from /lib64/libc.so.6
#7 0x000000000041e602 in vm_xfree (objspace=0xf6f7b70, ptr=0x11f91c60) at gc.c:732
#8 0x000000000041e78b in ruby_xfree (x=0x11f91c60) at gc.c:780
#9 0x00000000004dfe5c in time_free (tobj=0x11f91c60) at time.c:1806
#10 0x000000000042232f in run_final (objspace=0xf6f7b70, obj=283873120) at gc.c:2605
#11 0x00000000004204a5 in finalize_list (objspace=0xf6f7b70, p=0x10eb8f60) at gc.c:1808
#12 0x00000000004223a4 in finalize_deferred (objspace=0xf6f7b70) at gc.c:2621
#13 0x00000000004223bb in gc_finalize_deferred (objspace=0xf6f7b70) at gc.c:2628
#14 0x00000000004223dd in rb_gc_finalize_deferred () at gc.c:2635
#15 0x000000000052e73e in rb_threadptr_execute_interrupts_rec (th=0x11b3c230, sched_depth=0) at thread.c:1295
#16 0x000000000052e837 in rb_threadptr_execute_interrupts (th=0x11b3c230) at thread.c:1323
#17 0x000000000051f44f in vm_call_method (th=0x11b3c230, cfp=0x2aaab088c4e8, num=1, blockptr=0x0, flag=0, id=7072, me=0xf7d2b60, recv=259309440)
at vm_insnhelper.c:669
#18 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#19 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#20 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x2aaab088c618, self=265666400, argc=1, argv=0x40ccabc8, blockptr=0x0, cref=0x0)
at vm.c:557
#21 0x00000000005276c6 in vm_yield (th=0x11b3c230, argc=1, argv=0x40ccabc8) at vm.c:587
#22 0x000000000052417f in rb_yield_0 (argc=1, argv=0x40ccabc8) at vm_eval.c:731
#23 0x0000000000524153 in rb_yield (val=264390920) at vm_eval.c:741
#24 0x0000000000540018 in rb_ary_collect (ary=272006520) at array.c:2166
#25 0x000000000051f998 in call_cfunc (func=0x53ff4d <rb_ary_collect>, recv=272006520, len=0, argc=0, argv=0x2aaab078ec18) at vm_insnhelper.c:317
#26 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088c5f0, num=0, recv=272006520, blockptr=0x2aaab088c618, me=0xf7aeb30)
at vm_insnhelper.c:401
#27 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088c5f0, num=0, blockptr=0x2aaab088c618, flag=0, id=1536, me=0xf7aeb30, recv=272006520)
at vm_insnhelper.c:523
#28 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#29 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#30 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x2aaab088c8d8, self=271841760, argc=1, argv=0x40ccbd48, blockptr=0x0, cref=0x0)
at vm.c:557
#31 0x00000000005276c6 in vm_yield (th=0x11b3c230, argc=1, argv=0x40ccbd48) at vm.c:587
#32 0x000000000052417f in rb_yield_0 (argc=1, argv=0x40ccbd48) at vm_eval.c:731
#33 0x0000000000524153 in rb_yield (val=263084440) at vm_eval.c:741
#34 0x000000000053d736 in rb_ary_each (ary=263072400) at array.c:1427
#35 0x000000000051f998 in call_cfunc (func=0x53d6ac <rb_ary_each>, recv=263072400, len=0, argc=0, argv=0x2aaab078eab0) at vm_insnhelper.c:317
#36 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088c8b0, num=0, recv=263072400, blockptr=0x2aaab088c8d8, me=0xf7addc0)
at vm_insnhelper.c:401
#37 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088c8b0, num=0, blockptr=0x2aaab088c8d8, flag=0, id=424, me=0xf7addc0, recv=263072400)
at vm_insnhelper.c:523
#38 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#39 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#40 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x2aaab088ca38, self=271841760, argc=1, argv=0x40ccceb8, blockptr=0x0, cref=0x0)
at vm.c:557
#41 0x00000000005276c6 in vm_yield (th=0x11b3c230, argc=1, argv=0x40ccceb8) at vm.c:587
#42 0x000000000052417f in rb_yield_0 (argc=1, argv=0x40ccceb8) at vm_eval.c:731
#43 0x0000000000524153 in rb_yield (val=3956750) at vm_eval.c:741
#44 0x000000000053d736 in rb_ary_each (ary=263093600) at array.c:1427
#45 0x000000000051f998 in call_cfunc (func=0x53d6ac <rb_ary_each>, recv=263093600, len=0, argc=0, argv=0x2aaab078ea20) at vm_insnhelper.c:317
#46 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088ca10, num=0, recv=263093600, blockptr=0x2aaab088ca38, me=0xf7addc0)
at vm_insnhelper.c:401
#47 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088ca10, num=0, blockptr=0x2aaab088ca38, flag=0, id=424, me=0xf7addc0, recv=263093600)
at vm_insnhelper.c:523
#48 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#49 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#50 0x0000000000529391 in rb_iseq_eval (iseqval=272926200) at vm.c:1372
#51 0x000000000056ad05 in rb_load_internal (fname=280717600, wrap=0) at load.c:302
#52 0x000000000056af4a in rb_f_load (argc=1, argv=0x2aaab078e9a8) at load.c:375
#53 0x000000000051f980 in call_cfunc (func=0x56ae8b <rb_f_load>, recv=265666400, len=-1, argc=1, argv=0x2aaab078e9a8) at vm_insnhelper.c:314
#54 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088cbc8, num=1, recv=265666400, blockptr=0x0, me=0xfd96140) at vm_insnhelper.c:401
#55 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088cbc8, num=1, blockptr=0x0, flag=8, id=34488, me=0xfd96140, recv=265666400)
at vm_insnhelper.c:523
#56 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#57 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#58 0x0000000000522aaf in vm_call0 (th=0x11b3c230, recv=259360280, id=1144, argc=1, argv=0x40ccf2a0, me=0xfc62580) at vm_eval.c:66
#59 0x0000000000523d7f in rb_call0 (recv=259360280, mid=1144, argc=1, argv=0x40ccf2a0, scope=CALL_FCALL, self=6) at vm_eval.c:235
#60 0x0000000000523cd5 in rb_call (recv=259360280, mid=1144, argc=1, argv=0x40ccf2a0, scope=CALL_FCALL) at vm_eval.c:438
#61 0x0000000000523f8a in rb_funcall (recv=259360280, mid=1144, n=1) at vm_eval.c:637
#62 0x00000000004fb60e in const_missing (klass=259360280, id=88005) at variable.c:1360
#63 0x00000000004fbe1f in rb_const_get_0 (klass=259360280, id=88005, exclude=0, recurse=1) at variable.c:1600
#64 0x00000000004fbe8d in rb_const_get (klass=259360280, id=88005) at variable.c:1614
#65 0x000000000051e650 in vm_get_ev_const (th=0x11b3c230, iseq=0x12601510, orig_klass=4, id=88005, is_defined=0) at vm_insnhelper.c:1196
#66 0x0000000000517741 in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:223
#67 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#68 0x0000000000529391 in rb_iseq_eval (iseqval=281036160) at vm.c:1372
#69 0x000000000056ad05 in rb_load_internal (fname=282078760, wrap=0) at load.c:302
#70 0x000000000056af4a in rb_f_load (argc=1, argv=0x2aaab078e7e8) at load.c:375
#71 0x000000000051f980 in call_cfunc (func=0x56ae8b <rb_f_load>, recv=265666400, len=-1, argc=1, argv=0x2aaab078e7e8) at vm_insnhelper.c:314
#72 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088cf38, num=1, recv=265666400, blockptr=0x0, me=0xfd96140) at vm_insnhelper.c:401
#73 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088cf38, num=1, blockptr=0x0, flag=8, id=34488, me=0xfd96140, recv=265666400)
at vm_insnhelper.c:523
#74 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#75 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#76 0x0000000000522aaf in vm_call0 (th=0x11b3c230, recv=282348640, id=1144, argc=1, argv=0x40cd1630, me=0x100a4d00) at vm_eval.c:66
#77 0x0000000000523d7f in rb_call0 (recv=282348640, mid=1144, argc=1, argv=0x40cd1630, scope=CALL_FCALL, self=6) at vm_eval.c:235
#78 0x0000000000523cd5 in rb_call (recv=282348640, mid=1144, argc=1, argv=0x40cd1630, scope=CALL_FCALL) at vm_eval.c:438
#79 0x0000000000523f8a in rb_funcall (recv=282348640, mid=1144, n=1) at vm_eval.c:637
#80 0x00000000004fb60e in const_missing (klass=282348640, id=124773) at variable.c:1360
#81 0x00000000004fbe1f in rb_const_get_0 (klass=282348640, id=124773, exclude=1, recurse=0) at variable.c:1600
#82 0x00000000004fbeb6 in rb_const_get_at (klass=282348640, id=124773) at variable.c:1620
#83 0x000000000044cb0a in rb_mod_const_get (argc=2, argv=0x2aaab078e660, mod=282348640) at object.c:1695
#84 0x000000000051f980 in call_cfunc (func=0x44ca55 <rb_mod_const_get>, recv=282348640, len=-1, argc=2, argv=0x2aaab078e660) at vm_insnhelper.c:314
#85 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088d1f8, num=2, recv=282348640, blockptr=0x0, me=0xf767b70) at vm_insnhelper.c:401
#86 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088d1f8, num=2, blockptr=0x0, flag=0, id=1112, me=0xf767b70, recv=282348640)
at vm_insnhelper.c:523
#87 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#88 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#89 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x2aaab088d328, self=261961800, argc=1, argv=0x40cd2998, blockptr=0x0, cref=0x0)
at vm.c:557
#90 0x00000000005276c6 in vm_yield (th=0x11b3c230, argc=1, argv=0x40cd2998) at vm.c:587
#91 0x000000000052417f in rb_yield_0 (argc=1, argv=0x40cd2998) at vm_eval.c:731
#92 0x0000000000524153 in rb_yield (val=282361960) at vm_eval.c:741
#93 0x000000000053d736 in rb_ary_each (ary=282362240) at array.c:1427
#94 0x000000000051f998 in call_cfunc (func=0x53d6ac <rb_ary_each>, recv=282362240, len=0, argc=0, argv=0x2aaab078e620) at vm_insnhelper.c:317
#95 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088d300, num=0, recv=282362240, blockptr=0x2aaab088d328, me=0xf7addc0)
at vm_insnhelper.c:401
#96 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088d300, num=0, blockptr=0x2aaab088d328, flag=0, id=424, me=0xf7addc0, recv=282362240)
at vm_insnhelper.c:523
#97 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#98 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#99 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x127510b0, self=291970880, argc=1, argv=0x2aaab078e4f0, blockptr=0x0, cref=0x0)
at vm.c:557
#100 0x00000000005277c5 in rb_vm_invoke_proc (th=0x11b3c230, proc=0x127510b0, self=291970880, argc=1, argv=0x2aaab078e4f0, blockptr=0x0) at vm.c:603
---Type to continue, or q to quit---
#101 0x000000000041afa1 in proc_call (argc=1, argv=0x2aaab078e4f0, procval=282451640) at proc.c:556
#102 0x000000000051f980 in call_cfunc (func=0x41aefc <proc_call>, recv=282451640, len=-1, argc=1, argv=0x2aaab078e4f0) at vm_insnhelper.c:314
#103 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088d618, num=1, recv=282451640, blockptr=0x0, me=0xf7f0f00) at vm_insnhelper.c:401
#104 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088d618, num=1, blockptr=0x0, flag=0, id=5912, me=0xf7f0f00, recv=282451640)
at vm_insnhelper.c:523
#105 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#106 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#107 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x2aaab088dd20, self=295023880, argc=1, argv=0x40cd4d68, blockptr=0x0, cref=0x0)
at vm.c:557
#108 0x00000000005276c6 in vm_yield (th=0x11b3c230, argc=1, argv=0x40cd4d68) at vm.c:587
#109 0x000000000052417f in rb_yield_0 (argc=1, argv=0x40cd4d68) at vm_eval.c:731
#110 0x0000000000524153 in rb_yield (val=295023400) at vm_eval.c:741
#111 0x000000000053d736 in rb_ary_each (ary=295023360) at array.c:1427
#112 0x000000000051f998 in call_cfunc (func=0x53d6ac <rb_ary_each>, recv=295023360, len=0, argc=0, argv=0x2aaab078e218) at vm_insnhelper.c:317
#113 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088dcf8, num=0, recv=295023360, blockptr=0x2aaab088dd20, me=0xf7addc0)
at vm_insnhelper.c:401
#114 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088dcf8, num=0, blockptr=0x2aaab088dd20, flag=0, id=424, me=0xf7addc0, recv=295023360)
at vm_insnhelper.c:523
#115 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#116 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#117 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x119b71e0, self=294980880, argc=0, argv=0x10db1988, blockptr=0x0, cref=0x0)
at vm.c:557
#118 0x00000000005277c5 in rb_vm_invoke_proc (th=0x11b3c230, proc=0x119b71e0, self=294980880, argc=0, argv=0x10db1988, blockptr=0x0) at vm.c:603
#119 0x000000000052cfef in thread_start_func_2 (th=0x11b3c230, stack_start=0x40cd6120) at thread.c:441
#120 0x000000000052c16b in thread_start_func_1 (th_ptr=0x11b3c230) at thread_pthread.c:369
#121 0x00002b7ace98273d in start_thread () from /lib64/libpthread.so.0
#122 0x00002b7acf533d1d in clone () from /lib64/libc.so.6

Since we doubt it seems to be a thread safe problem with libxml_ruby.so , a simple test script is used (attached as testthreadxml.rb), and it seems it runs very unstable. sometimes, it throw below exception.

================
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/xml_mini.rb:15:in rescue in parse': parse delegated to backend.parse, but backend is nil: ActiveSupport::XmlMini (RuntimeError) from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/xml_mini.rb:12:in parse'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/core_ext/hash/conversions.rb:164:in from_xml' from testthreadxml.rb:12:in block in '

===============
problem never happen in ruby1.8.6 though.

would you help on such issue? thank you!
=end


Files

core-dump.zip (4.56 KB) core-dump.zip tracy_trend (tracy qin), 12/06/2010 05:26 PM
Actions #1

Updated by tracy_trend (tracy qin) over 13 years ago

=begin
HI,

Just make a further test based on the testthreadxml.rb.

Change file

/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/xml_mini.rb

From
XmlMini.backend = 'REXML'

To:
XmlMini.backend = 'LibXML'

Run testthreadxml.rb twice, crash would happen and same coredump can be seen.

Libxml version:
libxml-ruby (1.1.4)

Best wishes,
-Tracy

-----Original Message-----
From: tracy qin []
Sent: 2010年12月6日 16:26
To:
Subject: [Ruby 1.9-Bug#4123][Open] thread-safe problem in libxml_ruby.so

Bug #4123: thread-safe problem in libxml_ruby.so
http://redmine.ruby-lang.org/issues/show/4123

Author: tracy qin
Status: Open, Priority: Normal
Category: lib, Target version: 1.9.2
ruby -v: 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]

Hi,

We set up a rails webservice app using libxml_ruby.so, Hash.from_xml funtion.
This Webserive server works as one process and start new thread to handle each request. But crash always happens at the second call.

rails reported stacktrace as below: (also attached as "libxml_AbortStacktrace.txt"

-- Ruby level backtrace information ----------------------------------------
/usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in block in start_thread' /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in run'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in service' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/handler/webrick.rb:50:in service'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/content_length.rb:13:in call' /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.4/lib/rails/rack/log_tailer.rb:17:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in call' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in each'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/urlmap.rb:46:in block in call' /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.4/lib/rails/rack/static.rb:31:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:108:in call' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/reloader.rb:34:in run'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:114:in block in call' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/lock.rb:11:in call'
internal:prelude:10:in synchronize' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/lock.rb:11:in block in call'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/failsafe.rb:26:in call' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/session/cookie_store.rb:93:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/params_parser.rb:15:in call' /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/methodoverride.rb:24:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.0.1/lib/rack/head.rb:9:in call' /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in call'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:28:in call' /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:9:in cache'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in cache' /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:29:in block in call'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:29:in call' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:130:in block in build_middleware_stack'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:121:in _call' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:87:in dispatch'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:436:in call' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:443:in recognize'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/core_ext/string/inflections.rb:162:in constantize' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/inflector.rb:371:in constantize'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/inflector.rb:371:in each' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/inflector.rb:372:in block in constantize'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/inflector.rb:372:in const_get' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:80:in const_missing_with_dependencies'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:425:in load_missing_constant' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:259:in require_or_load'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:379:in load_file' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in new_constants_in'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:380:in block in load_file' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:380:in load'
/var/webapps/ws_ui/app/controllers/v20/stats_controller.rb:1:in <top (required)>' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:96:in const_missing'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:425:in load_missing_constant' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:259:in require_or_load'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:379:in load_file' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in new_constants_in'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:380:in block in load_file' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:380:in load'
/var/webapps/ws_ui/app/controllers/application_controller.rb:7:in <top (required)>' /var/webapps/ws_ui/app/controllers/application_controller.rb:9:in class:ApplicationController'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/helpers.rb:115:in helper' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/helpers.rb:115:in each'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/helpers.rb:120:in block in helper' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/helpers.rb:115:in helper'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/helpers.rb:115:in each' /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.4/lib/action_controller/helpers.rb:126:in block in helper'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:136:in require_dependency' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:224:in depend_on'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:259:in require_or_load' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:373:in load_file'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:312:in loadable_constants_for_path' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:312:in collect'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:313:in block in loadable_constants_for_path' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:313:in expand_path'

-- C level backtrace information -------------------------------------------
ruby(rb_vm_bugreport+0x68) [0x52bc38]
ruby [0x566a01]
ruby(rb_bug+0xee) [0x566b09]
ruby [0x4b3850]
/lib64/libpthread.so.0 [0x2af6da3fab10]
/lib64/libc.so.6 [0x2af6daf40485]
/lib64/libc.so.6 [0x2af6daf42a6c]
/lib64/libc.so.6(__libc_malloc+0x6e) [0x2af6daf44cde] ruby [0x41e4ae]
ruby(ruby_xmalloc2+0x64) [0x41e68d]
ruby [0x4c005d]
ruby(rb_str_new+0x24) [0x4c02b8]
ruby(rb_usascii_str_new+0x1d) [0x4c02d7]
ruby(rb_file_expand_path+0x40) [0x5702c7]
ruby(rb_file_s_expand_path+0x26) [0x570304] ruby [0x51f980] ruby [0x51f853] ruby [0x51ec2b] ruby [0x519abd] ruby [0x5289a5] ruby [0x52763f] ruby [0x5276c6] ruby [0x52417f]
ruby(rb_yield+0x39) [0x524153]
ruby [0x540018]
ruby [0x51f998]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x52763f]
ruby [0x5276c6]
ruby [0x52417f]
ruby(rb_yield+0x39) [0x524153]
ruby(rb_ary_each+0x8a) [0x53d736]
ruby [0x51f998]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x52763f]
ruby [0x5276c6]
ruby [0x52417f]
ruby(rb_yield+0x39) [0x524153]
ruby(rb_ary_each+0x8a) [0x53d736]
ruby [0x51f998]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby(rb_iseq_eval+0x2d) [0x529391]
ruby [0x56ad05]
ruby [0x56af4a]
ruby [0x51f980]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x522aaf]
ruby [0x523d7f]
ruby [0x523cd5]
ruby(rb_funcall+0x201) [0x523f8a]
ruby [0x4fb60e]
ruby [0x4fbe1f]
ruby(rb_const_get+0x27) [0x4fbe8d]
ruby [0x51e650]
ruby [0x517741]
ruby [0x5289a5]
ruby(rb_iseq_eval+0x2d) [0x529391]
ruby [0x56ad05]
ruby [0x56af4a]
ruby [0x51f980]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x522aaf]
ruby [0x523d7f]
ruby [0x523cd5]
ruby(rb_funcall+0x201) [0x523f8a]
ruby [0x4fb60e]
ruby [0x4fbe1f]
ruby(rb_const_get_at+0x27) [0x4fbeb6]
ruby [0x44cb0a]
ruby [0x51f980]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x52763f]
ruby [0x5276c6]
ruby [0x52417f]
ruby(rb_yield+0x39) [0x524153]
ruby(rb_ary_each+0x8a) [0x53d736]
ruby [0x51f998]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x52763f]
ruby(rb_vm_invoke_proc+0xfd) [0x5277c5]
ruby [0x41afa1]
ruby [0x51f980]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x52763f]
ruby [0x5276c6]
ruby [0x52417f]
ruby(rb_yield+0x39) [0x524153]
ruby(rb_ary_each+0x8a) [0x53d736]
ruby [0x51f998]
ruby [0x51f853]
ruby [0x51ec2b]
ruby [0x519abd]
ruby [0x5289a5]
ruby [0x52763f]
ruby(rb_vm_invoke_proc+0xfd) [0x5277c5]
ruby [0x52cfef]
ruby [0x52c16b]
/lib64/libpthread.so.0 [0x2af6da3f273d]
/lib64/libc.so.6(clone+0x6d) [0x2af6dafa3d1d]

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Aborted (core dumped)

Then we recompile ruby in debug mode and accquire below calldump. (also attached as libxml_coredump.txt)

===============
#0 0x00002b7acf490265 in raise () from /lib64/libc.so.6
#1 0x00002b7acf491d10 in abort () from /lib64/libc.so.6
#2 0x0000000000566b0e in rb_bug (fmt=0x5a70ff "Segmentation fault") at error.c:253
#3 0x00000000004b3850 in sigsegv (sig=11, info=0x1243afd0, ctx=0x1243aea0) at signal.c:613
#4
#5 0x00002b7acf4d1d26 in _int_free () from /lib64/libc.so.6
#6 0x00002b7acf4d276b in free () from /lib64/libc.so.6
#7 0x000000000041e602 in vm_xfree (objspace=0xf6f7b70, ptr=0x11f91c60) at gc.c:732
#8 0x000000000041e78b in ruby_xfree (x=0x11f91c60) at gc.c:780
#9 0x00000000004dfe5c in time_free (tobj=0x11f91c60) at time.c:1806 #10 0x000000000042232f in run_final (objspace=0xf6f7b70, obj=283873120) at gc.c:2605
#11 0x00000000004204a5 in finalize_list (objspace=0xf6f7b70, p=0x10eb8f60) at gc.c:1808
#12 0x00000000004223a4 in finalize_deferred (objspace=0xf6f7b70) at gc.c:2621
#13 0x00000000004223bb in gc_finalize_deferred (objspace=0xf6f7b70) at gc.c:2628
#14 0x00000000004223dd in rb_gc_finalize_deferred () at gc.c:2635
#15 0x000000000052e73e in rb_threadptr_execute_interrupts_rec (th=0x11b3c230, sched_depth=0) at thread.c:1295
#16 0x000000000052e837 in rb_threadptr_execute_interrupts (th=0x11b3c230) at thread.c:1323
#17 0x000000000051f44f in vm_call_method (th=0x11b3c230, cfp=0x2aaab088c4e8, num=1, blockptr=0x0, flag=0, id=7072, me=0xf7d2b60, recv=259309440)
at vm_insnhelper.c:669
#18 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#19 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145 #20 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x2aaab088c618, self=265666400, argc=1, argv=0x40ccabc8, blockptr=0x0, cref=0x0)
at vm.c:557
#21 0x00000000005276c6 in vm_yield (th=0x11b3c230, argc=1, argv=0x40ccabc8) at vm.c:587
#22 0x000000000052417f in rb_yield_0 (argc=1, argv=0x40ccabc8) at vm_eval.c:731
#23 0x0000000000524153 in rb_yield (val=264390920) at vm_eval.c:741
#24 0x0000000000540018 in rb_ary_collect (ary=272006520) at array.c:2166
#25 0x000000000051f998 in call_cfunc (func=0x53ff4d <rb_ary_collect>, recv=272006520, len=0, argc=0, argv=0x2aaab078ec18) at vm_insnhelper.c:317
#26 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088c5f0, num=0, recv=272006520, blockptr=0x2aaab088c618, me=0xf7aeb30)
at vm_insnhelper.c:401
#27 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088c5f0, num=0, blockptr=0x2aaab088c618, flag=0, id=1536, me=0xf7aeb30, recv=272006520)
at vm_insnhelper.c:523
#28 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#29 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145 #30 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x2aaab088c8d8, self=271841760, argc=1, argv=0x40ccbd48, blockptr=0x0, cref=0x0)
at vm.c:557
#31 0x00000000005276c6 in vm_yield (th=0x11b3c230, argc=1, argv=0x40ccbd48) at vm.c:587
#32 0x000000000052417f in rb_yield_0 (argc=1, argv=0x40ccbd48) at vm_eval.c:731
#33 0x0000000000524153 in rb_yield (val=263084440) at vm_eval.c:741
#34 0x000000000053d736 in rb_ary_each (ary=263072400) at array.c:1427
#35 0x000000000051f998 in call_cfunc (func=0x53d6ac <rb_ary_each>, recv=263072400, len=0, argc=0, argv=0x2aaab078eab0) at vm_insnhelper.c:317
#36 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088c8b0, num=0, recv=263072400, blockptr=0x2aaab088c8d8, me=0xf7addc0)
at vm_insnhelper.c:401
#37 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088c8b0, num=0, blockptr=0x2aaab088c8d8, flag=0, id=424, me=0xf7addc0, recv=263072400)
at vm_insnhelper.c:523
#38 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#39 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145 #40 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x2aaab088ca38, self=271841760, argc=1, argv=0x40ccceb8, blockptr=0x0, cref=0x0)
at vm.c:557
#41 0x00000000005276c6 in vm_yield (th=0x11b3c230, argc=1, argv=0x40ccceb8) at vm.c:587
#42 0x000000000052417f in rb_yield_0 (argc=1, argv=0x40ccceb8) at vm_eval.c:731
#43 0x0000000000524153 in rb_yield (val=3956750) at vm_eval.c:741
#44 0x000000000053d736 in rb_ary_each (ary=263093600) at array.c:1427
#45 0x000000000051f998 in call_cfunc (func=0x53d6ac <rb_ary_each>, recv=263093600, len=0, argc=0, argv=0x2aaab078ea20) at vm_insnhelper.c:317
#46 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088ca10, num=0, recv=263093600, blockptr=0x2aaab088ca38, me=0xf7addc0)
at vm_insnhelper.c:401
#47 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088ca10, num=0, blockptr=0x2aaab088ca38, flag=0, id=424, me=0xf7addc0, recv=263093600)
at vm_insnhelper.c:523
#48 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#49 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145 #50 0x0000000000529391 in rb_iseq_eval (iseqval=272926200) at vm.c:1372
#51 0x000000000056ad05 in rb_load_internal (fname=280717600, wrap=0) at load.c:302
#52 0x000000000056af4a in rb_f_load (argc=1, argv=0x2aaab078e9a8) at load.c:375
#53 0x000000000051f980 in call_cfunc (func=0x56ae8b <rb_f_load>, recv=265666400, len=-1, argc=1, argv=0x2aaab078e9a8) at vm_insnhelper.c:314
#54 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088cbc8, num=1, recv=265666400, blockptr=0x0, me=0xfd96140) at vm_insnhelper.c:401
#55 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088cbc8, num=1, blockptr=0x0, flag=8, id=34488, me=0xfd96140, recv=265666400)
at vm_insnhelper.c:523
#56 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#57 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#58 0x0000000000522aaf in vm_call0 (th=0x11b3c230, recv=259360280, id=1144, argc=1, argv=0x40ccf2a0, me=0xfc62580) at vm_eval.c:66
#59 0x0000000000523d7f in rb_call0 (recv=259360280, mid=1144, argc=1, argv=0x40ccf2a0, scope=CALL_FCALL, self=6) at vm_eval.c:235 #60 0x0000000000523cd5 in rb_call (recv=259360280, mid=1144, argc=1, argv=0x40ccf2a0, scope=CALL_FCALL) at vm_eval.c:438
#61 0x0000000000523f8a in rb_funcall (recv=259360280, mid=1144, n=1) at vm_eval.c:637
#62 0x00000000004fb60e in const_missing (klass=259360280, id=88005) at variable.c:1360
#63 0x00000000004fbe1f in rb_const_get_0 (klass=259360280, id=88005, exclude=0, recurse=1) at variable.c:1600
#64 0x00000000004fbe8d in rb_const_get (klass=259360280, id=88005) at variable.c:1614
#65 0x000000000051e650 in vm_get_ev_const (th=0x11b3c230, iseq=0x12601510, orig_klass=4, id=88005, is_defined=0) at vm_insnhelper.c:1196
#66 0x0000000000517741 in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:223
#67 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#68 0x0000000000529391 in rb_iseq_eval (iseqval=281036160) at vm.c:1372
#69 0x000000000056ad05 in rb_load_internal (fname=282078760, wrap=0) at load.c:302 #70 0x000000000056af4a in rb_f_load (argc=1, argv=0x2aaab078e7e8) at load.c:375
#71 0x000000000051f980 in call_cfunc (func=0x56ae8b <rb_f_load>, recv=265666400, len=-1, argc=1, argv=0x2aaab078e7e8) at vm_insnhelper.c:314
#72 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088cf38, num=1, recv=265666400, blockptr=0x0, me=0xfd96140) at vm_insnhelper.c:401
#73 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088cf38, num=1, blockptr=0x0, flag=8, id=34488, me=0xfd96140, recv=265666400)
at vm_insnhelper.c:523
#74 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#75 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#76 0x0000000000522aaf in vm_call0 (th=0x11b3c230, recv=282348640, id=1144, argc=1, argv=0x40cd1630, me=0x100a4d00) at vm_eval.c:66
#77 0x0000000000523d7f in rb_call0 (recv=282348640, mid=1144, argc=1, argv=0x40cd1630, scope=CALL_FCALL, self=6) at vm_eval.c:235
#78 0x0000000000523cd5 in rb_call (recv=282348640, mid=1144, argc=1, argv=0x40cd1630, scope=CALL_FCALL) at vm_eval.c:438
#79 0x0000000000523f8a in rb_funcall (recv=282348640, mid=1144, n=1) at vm_eval.c:637 #80 0x00000000004fb60e in const_missing (klass=282348640, id=124773) at variable.c:1360
#81 0x00000000004fbe1f in rb_const_get_0 (klass=282348640, id=124773, exclude=1, recurse=0) at variable.c:1600
#82 0x00000000004fbeb6 in rb_const_get_at (klass=282348640, id=124773) at variable.c:1620
#83 0x000000000044cb0a in rb_mod_const_get (argc=2, argv=0x2aaab078e660, mod=282348640) at object.c:1695
#84 0x000000000051f980 in call_cfunc (func=0x44ca55 <rb_mod_const_get>, recv=282348640, len=-1, argc=2, argv=0x2aaab078e660) at vm_insnhelper.c:314
#85 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088d1f8, num=2, recv=282348640, blockptr=0x0, me=0xf767b70) at vm_insnhelper.c:401
#86 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088d1f8, num=2, blockptr=0x0, flag=0, id=1112, me=0xf767b70, recv=282348640)
at vm_insnhelper.c:523
#87 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#88 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#89 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x2aaab088d328, self=261961800, argc=1, argv=0x40cd2998, blockptr=0x0, cref=0x0)
at vm.c:557
#90 0x00000000005276c6 in vm_yield (th=0x11b3c230, argc=1, argv=0x40cd2998) at vm.c:587
#91 0x000000000052417f in rb_yield_0 (argc=1, argv=0x40cd2998) at vm_eval.c:731
#92 0x0000000000524153 in rb_yield (val=282361960) at vm_eval.c:741
#93 0x000000000053d736 in rb_ary_each (ary=282362240) at array.c:1427
#94 0x000000000051f998 in call_cfunc (func=0x53d6ac <rb_ary_each>, recv=282362240, len=0, argc=0, argv=0x2aaab078e620) at vm_insnhelper.c:317
#95 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088d300, num=0, recv=282362240, blockptr=0x2aaab088d328, me=0xf7addc0)
at vm_insnhelper.c:401
#96 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088d300, num=0, blockptr=0x2aaab088d328, flag=0, id=424, me=0xf7addc0, recv=282362240)
at vm_insnhelper.c:523
#97 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#98 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#99 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x127510b0, self=291970880, argc=1, argv=0x2aaab078e4f0, blockptr=0x0, cref=0x0)
at vm.c:557
#100 0x00000000005277c5 in rb_vm_invoke_proc (th=0x11b3c230, proc=0x127510b0, self=291970880, argc=1, argv=0x2aaab078e4f0, blockptr=0x0) at vm.c:603 ---Type to continue, or q to quit---
#101 0x000000000041afa1 in proc_call (argc=1, argv=0x2aaab078e4f0, procval=282451640) at proc.c:556
#102 0x000000000051f980 in call_cfunc (func=0x41aefc <proc_call>, recv=282451640, len=-1, argc=1, argv=0x2aaab078e4f0) at vm_insnhelper.c:314
#103 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088d618, num=1, recv=282451640, blockptr=0x0, me=0xf7f0f00) at vm_insnhelper.c:401
#104 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088d618, num=1, blockptr=0x0, flag=0, id=5912, me=0xf7f0f00, recv=282451640)
at vm_insnhelper.c:523
#105 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#106 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#107 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x2aaab088dd20, self=295023880, argc=1, argv=0x40cd4d68, blockptr=0x0, cref=0x0)
at vm.c:557
#108 0x00000000005276c6 in vm_yield (th=0x11b3c230, argc=1, argv=0x40cd4d68) at vm.c:587
#109 0x000000000052417f in rb_yield_0 (argc=1, argv=0x40cd4d68) at vm_eval.c:731 #110 0x0000000000524153 in rb_yield (val=295023400) at vm_eval.c:741
#111 0x000000000053d736 in rb_ary_each (ary=295023360) at array.c:1427
#112 0x000000000051f998 in call_cfunc (func=0x53d6ac <rb_ary_each>, recv=295023360, len=0, argc=0, argv=0x2aaab078e218) at vm_insnhelper.c:317
#113 0x000000000051f853 in vm_call_cfunc (th=0x11b3c230, reg_cfp=0x2aaab088dcf8, num=0, recv=295023360, blockptr=0x2aaab088dd20, me=0xf7addc0)
at vm_insnhelper.c:401
#114 0x000000000051ec2b in vm_call_method (th=0x11b3c230, cfp=0x2aaab088dcf8, num=0, blockptr=0x2aaab088dd20, flag=0, id=424, me=0xf7addc0, recv=295023360)
at vm_insnhelper.c:523
#115 0x0000000000519abd in vm_exec_core (th=0x11b3c230, initial=0) at insns.def:1006
#116 0x00000000005289a5 in vm_exec (th=0x11b3c230) at vm.c:1145
#117 0x000000000052763f in invoke_block_from_c (th=0x11b3c230, block=0x119b71e0, self=294980880, argc=0, argv=0x10db1988, blockptr=0x0, cref=0x0)
at vm.c:557
#118 0x00000000005277c5 in rb_vm_invoke_proc (th=0x11b3c230, proc=0x119b71e0, self=294980880, argc=0, argv=0x10db1988, blockptr=0x0) at vm.c:603
#119 0x000000000052cfef in thread_start_func_2 (th=0x11b3c230, stack_start=0x40cd6120) at thread.c:441 #120 0x000000000052c16b in thread_start_func_1 (th_ptr=0x11b3c230) at thread_pthread.c:369
#121 0x00002b7ace98273d in start_thread () from /lib64/libpthread.so.0
#122 0x00002b7acf533d1d in clone () from /lib64/libc.so.6 ===============

Since we doubt it seems to be a thread safe problem with libxml_ruby.so , a simple test script is used (attached as testthreadxml.rb), and it seems it runs very unstable. sometimes, it throw below exception.

================
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/xml_mini.rb:15:in rescue in parse': parse delegated to backend.parse, but backend is nil: ActiveSupport::XmlMini (RuntimeError) from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/xml_mini.rb:12:in parse'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/core_ext/hash/conversions.rb:164:in from_xml' from testthreadxml.rb:12:in block in '

===============
problem never happen in ruby1.8.6 though.

would you help on such issue? thank you!


http://redmine.ruby-lang.org

TREND MICRO EMAIL NOTICE
The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system.

=end

Actions #2

Updated by naruse (Yui NARUSE) over 13 years ago

  • Status changed from Open to Third Party's Issue

=begin
It seems that libxml-ruby makes a wronb object and crashes when GC collect it.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0