jeremyevans / home_run

Fast Date/DateTime classes for ruby :: Unmaintained, unnecessary on ruby 1.9.3+
Other
465 stars 10 forks source link

I got segfault while running autotest #18

Closed sr3d closed 13 years ago

sr3d commented 13 years ago

Not sure if this is helpful or not, but I ran into a segfault while running my test suite. I just wanted to report here for the record, but if this segfault not a valid bug then please go ahead and close it.

/Users/sr3d/projects/marrily/bundles/m3/ruby/1.9.1/gems/home_run-0.9.3/lib/date_ext.bundle: [BUG] Segmentation fault ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]

-- control frame ---------- c:0030 p:-541733942 s:0089 b:0089 l:000088 d:000088 TOP
c:0029 p:---- s:0087 b:0087 l:000086 d:000086 CFUNC :require c:0028 p:0013 s:0083 b:0083 l:000082 d:000082 TOP /Users/sr3d/projects/marrily/bundles/m3/ruby/1.9.1/gems/home_run-0.9.3/lib/date.rb:2 c:0027 p:---- s:0081 b:0081 l:000080 d:000080 FINISH c:0026 p:---- s:0079 b:0079 l:000078 d:000078 CFUNC :load c:0025 p:0118 s:0075 b:0075 l:000074 d:000074 TOP /Users/sr3d/projects/marrily/bundles/m3/ruby/1.9.1/gems/home_run-0.9.3/lib/home_run.rb:4 c:0024 p:---- s:0072 b:0072 l:000071 d:000071 FINISH c:0023 p:---- s:0070 b:0070 l:000069 d:000069 CFUNC :require c:0022 p:0038 s:0066 b:0066 l:000065 d:000065 TOP /Users/sr3d/projects/marrily/svn/marrily_marrily/m3/app/config/application.rb:2 c:0021 p:---- s:0064 b:0064 l:000063 d:000063 FINISH c:0020 p:---- s:0062 b:0062 l:000061 d:000061 CFUNC :require c:0019 p:0013 s:0058 b:0058 l:000057 d:000057 METHOD internal:lib/rubygems/custom_require:29 c:0018 p:0026 s:0053 b:0053 l:000052 d:000052 TOP /Users/sr3d/projects/marrily/svn/marrily_marrily/m3/app/config/environment.rb:2 c:0017 p:---- s:0051 b:0051 l:000050 d:000050 FINISH c:0016 p:---- s:0049 b:0049 l:000048 d:000048 CFUNC :require c:0015 p:0013 s:0045 b:0045 l:000044 d:000044 METHOD internal:lib/rubygems/custom_require:29 c:0014 p:0046 s:0040 b:0040 l:000039 d:000039 TOP /Users/sr3d/projects/marrily/svn/marrily_marrily/m3/app/test/test_helper.rb:2 c:0013 p:---- s:0038 b:0038 l:000037 d:000037 FINISH c:0012 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC :require c:0011 p:0013 s:0032 b:0032 l:000031 d:000031 METHOD internal:lib/rubygems/custom_require:29 c:0010 p:0011 s:0027 b:0027 l:000026 d:000026 TOP /Users/sr3d/projects/marrily/svn/marrily_marrily/m3/app/test/unit/budget_test.rb:1 c:0009 p:---- s:0025 b:0025 l:000024 d:000024 FINISH c:0008 p:---- s:0023 b:0023 l:000022 d:000022 CFUNC :require c:0007 p:0013 s:0019 b:0019 l:000018 d:000018 METHOD internal:lib/rubygems/custom_require:29 c:0006 p:0012 s:0014 b:0014 l:0022f8 d:000013 BLOCK -e:1 c:0005 p:---- s:0011 b:0011 l:000010 d:000010 FINISH c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :each c:0003 p:0268 s:0006 b:0006 l:0022f8 d:0016a8 EVAL -e:1 c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH

c:0001 p:0000 s:0002 b:0002 l:0022f8 d:0022f8 TOP

-- Ruby level backtrace information ---------------------------------------- -e:1:in <main>' -e:1:ineach' -e:1:in block in <main>' <internal:lib/rubygems/custom_require>:29:inrequire' internal:lib/rubygems/custom_require:29:in require' /Users/sr3d/projects/marrily/svn/marrily_marrily/m3/app/test/unit/budget_test.rb:1:in<top (required)>' internal:lib/rubygems/custom_require:29:in require' <internal:lib/rubygems/custom_require>:29:inrequire' /Users/sr3d/projects/marrily/svn/marrily_marrily/m3/app/test/test_helper.rb:2:in <top (required)>' <internal:lib/rubygems/custom_require>:29:inrequire' internal:lib/rubygems/custom_require:29:in require' /Users/sr3d/projects/marrily/svn/marrily_marrily/m3/app/config/environment.rb:2:in<top (required)>' internal:lib/rubygems/custom_require:29:in require' <internal:lib/rubygems/custom_require>:29:inrequire' /Users/sr3d/projects/marrily/svn/marrily_marrily/m3/app/config/application.rb:2:in <top (required)>' /Users/sr3d/projects/marrily/svn/marrily_marrily/m3/app/config/application.rb:2:inrequire' /Users/sr3d/projects/marrily/bundles/m3/ruby/1.9.1/gems/home_run-0.9.3/lib/home_run.rb:4:in <top (required)>' /Users/sr3d/projects/marrily/bundles/m3/ruby/1.9.1/gems/home_run-0.9.3/lib/home_run.rb:4:inload' /Users/sr3d/projects/marrily/bundles/m3/ruby/1.9.1/gems/home_run-0.9.3/lib/date.rb:2:in <top (required)>' /Users/sr3d/projects/marrily/bundles/m3/ruby/1.9.1/gems/home_run-0.9.3/lib/date.rb:2:inrequire'

-- C level backtrace information -------------------------------------------

[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

jeremyevans commented 13 years ago

Could you grab the core file it created (if any) and get a gdb backtrace from it (usually gdb ruby ruby.core and then the bt command). If it didn't produce a core file, can you run autotest inside gdb to see if you can get a backtrace. Also, it may help to use the debugging version of the library, which you can install with:

DEBUG=1 gem install home_run

Another thing to try would be to not require home_run, but to use bin/home_run --install to install to site_packages, or bin/home_run autotest to run the tests.

sr3d commented 13 years ago

I tried to find the core dump file but not sure where to look for it. I'm using RVM and bundle so any hint is appreciated.

Regarding your comment on not requiring home_run, since I'm using RVM, Rails 3 and bundle on both the local machine (mac) and server (CentOs), so far for me this is the only way to get it working properly with ruby 1.9.2. Things are running very stable thus far and this segfault is the first time that it happened. I suspect that it's probably due to the fact that autotest are reloading everything and sometimes weird things could happen.

So if you know where I can find the core dump file, I'll hunt for it and upload it for you.

Thanks,

Alex

jeremyevans commented 13 years ago

Well, a core file by itself will do me no good. If there is a core file, it should be in the working directory, or whatever the working directory was at the time of the segfault. And if you find it, you'll have to run the gdb commands on it yourself.

Is this error repeatable? It sounds like it only happened once, which is going to make it hard to diagnose.

I don't think home_run does anything special to prevent the extension from being loaded more than once, but even if you try to do so manually, I can only get warnings for some already initialized constants, I can't get segfaults.

sr3d commented 13 years ago

I ran into a 2nd segfault. The stacktrace is similar to the first one and here's the pastie link: http://pastie.org/1241849. Right now I don't know there's a way to replicate this issue either. I tried to look on Google on how to obtain the core dump file but so far I came up empty. I guess a way to do it to attach gdb to autotest/rubuy process -- however, I don't know all the tools well enough at this moment to do so. I'll keep you posted.

scorpio commented 13 years ago

There is a related segfault log on rspec

/usr/local/rvm/gems/ruby-1.9.2-p0/gems/home_run-0.9.4/lib/date/format.rb:63: [BUG] Segmentation fault ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]

-- control frame ---------- c:0030 p:0013 s:0089 b:0088 l:000079 d:000087 BLOCK /usr/local/rvm/gems/ruby-1.9.2-p0/gems/home_run-0.9.4/lib/date/format.rb:63 c:0029 p:---- s:0085 b:0085 l:000084 d:000084 FINISH c:0028 p:---- s:0083 b:0083 l:000082 d:000082 CFUNC :each c:0027 p:0346 s:0080 b:0080 l:000079 d:000079 CLASS /usr/local/rvm/gems/ruby-1.9.2-p0/gems/home_run-0.9.4/lib/date/format.rb:62 c:0026 p:0013 s:0078 b:0078 l:000077 d:000077 CLASS /usr/local/rvm/gems/ruby-1.9.2-p0/gems/home_run-0.9.4/lib/date/format.rb:17 c:0025 p:0048 s:0076 b:0076 l:000075 d:000075 TOP /usr/local/rvm/gems/ruby-1.9.2-p0/gems/home_run-0.9.4/lib/date/format.rb:6 c:0024 p:---- s:0074 b:0074 l:000073 d:000073 FINISH c:0023 p:---- s:0072 b:0072 l:000071 d:000071 CFUNC :load c:0022 p:0183 s:0068 b:0068 l:000067 d:000067 TOP /usr/local/rvm/gems/ruby-1.9.2-p0/gems/home_run-0.9.4/lib/home_run.rb:5 c:0021 p:---- s:0065 b:0065 l:000064 d:000064 FINISH c:0020 p:---- s:0063 b:0063 l:000062 d:000062 CFUNC :require c:0019 p:0319 s:0059 b:0059 l:000058 d:000058 TOP /root/.cruise/projects/project-b21/work/config/boot.rb:32

c:0018 p:---- s:0057 b:0057 l:000056 d:000056 FINISH c:0017 p:---- s:0055 b:0055 l:000054 d:000054 CFUNC :require c:0016 p:0135 s:0051 b:0051 l:000348 d:000348 TOP /root/.cruise/projects/project-b21/work/spec/spec_helper.rb:29 c:0015 p:---- s:0049 b:0049 l:000048 d:000048 FINISH c:0014 p:---- s:0047 b:0047 l:000046 d:000046 CFUNC :require c:0013 p:0011 s:0043 b:0043 l:000042 d:000042 TOP /root/.cruise/projects/project-b21/work/source/game/test/service/public/game_service_spec.rb:1 c:0012 p:---- s:0041 b:0041 l:000040 d:000040 FINISH c:0011 p:---- s:0039 b:0039 l:000038 d:000038 CFUNC :load c:0010 p:0025 s:0035 b:0035 l:000026 d:000034 BLOCK /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/configuration.rb:327 c:0009 p:---- s:0032 b:0032 l:000031 d:000031 FINISH c:0008 p:---- s:0030 b:0030 l:000029 d:000029 CFUNC :map c:0007 p:0017 s:0027 b:0027 l:000026 d:000026 METHOD /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/configuration.rb:327 c:0006 p:0074 s:0024 b:0024 l:000023 d:000023 METHOD /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/command_line.rb:18 c:0005 p:0055 s:0019 b:0019 l:000018 d:000018 METHOD /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/runner.rb:55 c:0004 p:0107 s:0013 b:0013 l:000012 d:000012 METHOD /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/runner.rb:46 c:0003 p:0020 s:0006 b:0006 l:0023a8 d:000005 BLOCK /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/runner.rb:10 c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH

c:0001 p:0000 s:0002 b:0002 l:002488 d:002488 TOP

-- Ruby level backtrace information ---------------------------------------- /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/runner.rb:10:in block in autorun' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/runner.rb:46:inrun' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/runner.rb:55:in run_in_process' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/command_line.rb:18:inrun' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/configuration.rb:327:in load_spec_files' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/configuration.rb:327:inmap' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/configuration.rb:327:in block in load_spec_files' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.2.1/lib/rspec/core/configuration.rb:327:inload' /root/.cruise/projects/project-b21/work/source/game/test/service/public/game_service_spec.rb:1:in &lt;top (required)&gt;' <a href="/projects/code/project-b21/source/game/test/service/public/game_service_spec.rb?line=1#1">/root/.cruise/projects/project-b21/work/source/game/test/service/public/game_service_spec.rb:1</a>:inrequire' /root/.cruise/projects/project-b21/work/spec/spec_helper.rb:29:in `<top (required)>'

/root/.cruise/projects/project-b21/work/spec/spec_helper.rb:29:in require' <a href="/projects/code/project-b21/config/boot.rb?line=32#32">/root/.cruise/projects/project-b21/work/config/boot.rb:32</a>:in<top (required)>' /root/.cruise/projects/project-b21/work/config/boot.rb:32:in require' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/home_run-0.9.4/lib/home_run.rb:5:in<top (required)>' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/home_run-0.9.4/lib/home_run.rb:5:in load' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/home_run-0.9.4/lib/date/format.rb:6:in<top (required)>' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/home_run-0.9.4/lib/date/format.rb:17:in &lt;class:Date&gt;' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/home_run-0.9.4/lib/date/format.rb:62:in<module:Format>' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/home_run-0.9.4/lib/date/format.rb:62:in each' /usr/local/rvm/gems/ruby-1.9.2-p0/gems/home_run-0.9.4/lib/date/format.rb:63:inblock in <module:Format>'

-- C level backtrace information ------------------------------------------- /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_vm_bugreport+0x5f) [0x7f0a85258b4f] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a851474ee] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_bug+0xb3) [0x7f0a85147693] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a851eb6a5] /lib/libpthread.so.0 [0x7f0a84ed8760] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(st_lookup+0xe) [0x7f0a851f2bce] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_method_entry_get_without_cache+0x2f) [0x7f0a8524464f] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8524c874] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8524da79] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_yield+0x27a) [0x7f0a8525791a] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_ary_each+0x45) [0x7f0a85116ef5] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85253618] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85246949] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8524da79] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_iseq_eval+0x1e6) [0x7f0a8524e0b6] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8514cdb0] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8514cf0d] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85253618] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85246949] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8524da79] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_iseq_eval+0x1e6) [0x7f0a8524e0b6] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8514cdb0] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_require_safe+0x67f) [0x7f0a8514e4ef] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85253618] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85246949] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8524da79] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_iseq_eval+0x1e6) [0x7f0a8524e0b6] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8514cdb0] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_require_safe+0x67f) [0x7f0a8514e4ef] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85253618] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85246949] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8524da79] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_iseq_eval+0x1e6) [0x7f0a8524e0b6] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8514cdb0] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_require_safe+0x67f) [0x7f0a8514e4ef] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85253618] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85246949] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8524da79] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_iseq_eval+0x1e6) [0x7f0a8524e0b6] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8514cdb0] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8514cf0d] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85253618] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85246949] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8524da79] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_yield+0x27a) [0x7f0a8525791a] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8511df25] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85253618] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a85246949] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8524da79] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_vm_invoke_proc+0x3b3) [0x7f0a8524eea3] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_exec_end_proc+0x2b8) [0x7f0a8514b538] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f0a8514b5b7] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(ruby_cleanup+0x132) [0x7f0a8514b732] /usr/local/rvm/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(ruby_run_node+0x25) [0x7f0a8514ba35] ruby(main+0x4b) [0x4009eb] /lib/libc.so.6(__libc_start_main+0xf4) [0x7f0a842d3a44] ruby [0x4008f9]

[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

jeremyevans commented 13 years ago

That looks odd, as it's caused when calling freeze, which home_run does not override. It appears to more of an interpreter bug than a home_run issue. It appears that in some cases, the ruby interpreter does not like Date::ZONES, even though I can't find an invalid call. It's just rb_hash_new followed by rb_hash_aset with rb_str_new2 keys and INT2FIX values. I'm considering just moving the constant to the date/format.rb file instead of defining it in C, just to work around this issue.

jeremyevans commented 13 years ago

I just pushed a commit (https://github.com/jeremyevans/home_run/commit/c4b610f011f1d7b3bcef1dd993bc129511eb8ae1) and released a new 1.0.0 gem that should fix this issue by defining the ZONES hash in ruby instead of C.