Hi!
I'm using TCS builds of Ruby, but for some reason started getting crashes for one specific project. I tried to minimize the code involved and solved one problem by updating a rspec gem (doesn't make sense actually, but it worked - i even tried uninstalling that newer version and crashes were back), but i'm still getting random crashes. Since i don't feel myself at home debugging these kinds of things then i'm hoping that someone from here can help me with this.
Here is the "minimal" code needed to reproduce the crashes on my 64bit win7:
require "rspec"
require "win32ole"
require "sinatra"
class MyApp < Sinatra::Base
set :server, :webrick
end
describe "crash" do
before do
@thread = Thread.new {MyApp.run!}
end
it "it will crash - always" do
ie = WIN32OLE.new('InternetExplorer.Application')
ie.navigate "about:blank"
ie.visible = true
puts ie.document.location
end
after do
@thread.join
end
end
1. RSpec has to be used, it won't crash without it
2. Sinatra app thread has to be started at "before" or "let" block - it won't crash if i move it to the start of "it" block
3. Thread has to be joined in "after" block - it won't crash if moved to the end of "it" block
4. ie.document.location code has to be called - it won't crash otherwise
As you can see - here are some really strange conditions for the crash to happen.
Versions:
tcs-ruby 1.9.3p231 (2012-05-25, TCS patched 2012-05-27) [i386-mingw32]
sinatra (1.3.2)
rspec (2.9.0)
rspec-core (2.9.0)
rspec-expectations (2.9.0)
rspec-mocks (2.9.0)
If i upgrade rspec to 2.11.0 then the code above does NOT create a crash anymore, but more complex code still causes crashes. I suspect it has something to do with the win32ole, maybe some other code with other conditions, really hard to find out since as mentioned above then crashes after rspec upgrade seem to happen at random times so i can't put a breakpoint into ruby code yet.
Crashes also happen with tcs-ruby 1.9.3p196 (2012-04-21, TCS patched 2012-04-21). The code above won't crash official RubyInstaller 1.9.3p194, but i see random crashes with that too.
At first i have some really general questions - how to get more meaningful information about crashes compared to Windows event viewer where i can just see that ruby.exe has crashed?
Can i find out somehow which line of Ruby code creates the situation, which causes a crash?
Any other helpful tips which might help me regarding this kind of errors?