Issue #6426 has been reported by zhimin (Zhimin  Zhan).

----------------------------------------
Bug #6426: Segmentation fault when invoking 
https://bugs.ruby-lang.org/issues/6426

Author: zhimin (Zhimin  Zhan)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 1.9.3
ruby -v: 1.9.3p194


Hi, 

The Seg fault happens when invoking the test below (Ruby 1.9.3p194 on Windows XP SP3). Ran Ok when commented out $semaphore.lock line.
 
  $semaphore = Mutex.new

  # ..
  def test_run_spec_file_web
    $LOADWISE_PREVIEW = true
    tmp_spec_file = SpecFile.new
    tmp_spec_file.file_path = test_project_file("sign_in_test.rb")
    thread = RSpec2Executor.run_spec(tmp_spec_file)
    thread.join
  end

in RSpec2Executor class
  
  ## Invoke a RSpec to run Watir (OLE) test
  # 
  def self.run_spec(spec)
    thread = Thread.new do
       $semaphore.lock  # if commented out this line, it is fine
       test_file = spec.file_path
       RSpec::Core::Runner.run([test_file])
    end
  end
  

Error Trace:

rspec2_executor_test.rb: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20) [i386-mingw32]

-- Control frame information -----------------------------------------------
c:0001 p:0000 s:0002 b:0002 l:0016fc d:0016fc TOP


-- C level backtrace information -------------------------------------------
C:\WINDOWS\system32\ntdll.dll(KiFastSystemCallRet+0x0) [0x7c90e514]
C:\WINDOWS\system32\kernel32.dll(WaitForSingleObject+0x12) [0x7c802542]
c:\work\app\vendor\ruby-1.9.3-p194-i386-mingw32\bin\msvcrt-ruby191.dll(rb_vm_bugreport+0xf9) [0x62e5c589]
c:\work\app\vendor\ruby-1.9.3-p194-i386-mingw32\bin\msvcrt-ruby191.dll(rb_name_err_mesg_new+0x17a) [0x62d3a7e2]
c:\work\app\vendor\ruby-1.9.3-p194-i386-mingw32\bin\msvcrt-ruby191.dll(rb_bug+0x2f) [0x62d3b4fb]
c:\work\app\vendor\ruby-1.9.3-p194-i386-mingw32\bin\msvcrt-ruby191.dll(rb_check_safe_str+0x1a4)
 [0x62dee168]
 [0x004011e6]
 [0x10006985]

-- Other runtime information -----------------------------------------------

* Loaded script: rspec2_executor_test.rb

* Loaded features:

    0 enumerator.so
    1 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/i386-mingw32/enc/encdb.so
    2 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/i386-mingw32/enc/iso_8859_1.so
    3 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/i386-mingw32/enc/trans/transdb.so
    4 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/site_ruby/1.9.1/rubygems/defaults.rb
    5 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/i386-mingw32/rbconfig.rb6 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb
    7 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/site_ruby/1.9.1/rubygems/exceptions.rb
    8 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/site_ruby/1.9.1/rubygems/defaults/operating_system.rb
    9 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
   10 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/site_ruby/1.9.1/rubygems.rb
   11 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/site_ruby/1.9.1/ubygems.rb
   12 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/optparse.rb
   13 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/minitest/unit.rb
   14 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/prettyprint.rb
   15 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/pp.rb
   16 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/test/unit/assertions.rb
   17 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/test/unit/testcase.rb
   18 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/test/unit.rb
   19 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/i386-mingw32/pathname.so
   20 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/pathname.rb
   21 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/site_ruby/1.9.1/rubygems/version.rb
   22 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/i386-mingw32/etc.so
   23 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/i386-mingw32/enc/utf_16le.so
   24 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/i386-mingw32/enc/trans/utf_16_32.so
   25 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/1.9.1/i386-mingw32/enc/trans/single_byte.so
   26 c:/work/app/vendor/ruby-1.9.3-p194-i386-mingw32/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb


-- 
http://bugs.ruby-lang.org/