Bug #2783

Segmentation Fault (using libxml-ruby)

Added by Damián D'Onia almost 2 years ago. Updated 10 months ago.

[ruby-core:28315]
Status:Rejected Start date:02/24/2010
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:-
ruby -v:ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]

Description

I was running a program that creates a new XML node each iteration and save it to a file. I'm newbi using Ruby. This was the error text:

C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:36: [BUG] Segmentation fault
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]

-- control frame ----------
c:0015 p:---- s:0051 b:0051 l:000050 d:000050 CFUNC  :[]
c:0014 p:0008 s:0047 b:0047 l:000028 d:000046 BLOCK  C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:36
c:0013 p:---- s:0043 b:0043 l:000042 d:000042 FINISH
c:0012 p:---- s:0041 b:0041 l:000040 d:000040 CFUNC  :each
c:0011 p:0058 s:0038 b:0038 l:000028 d:000037 BLOCK  C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:35
c:0010 p:---- s:0034 b:0034 l:000033 d:000033 FINISH
c:0009 p:---- s:0032 b:0032 l:000031 d:000031 CFUNC  :each
c:0008 p:0055 s:0029 b:0029 l:000028 d:000028 METHOD C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:32
c:0007 p:0118 s:0025 b:0025 l:000024 d:000024 METHOD C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file_manager.rb:111
c:0006 p:0065 s:0018 b:0018 l:001a3c d:000017 BLOCK  C:/workspace/netbeans/DespegarLogPreProcessor/lib/main.rb:20
c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC  :each
c:0003 p:0108 s:0008 b:0008 l:001a3c d:00193c EVAL   C:/workspace/netbeans/DespegarLogPreProcessor/lib/main.rb:13
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001a3c d:001a3c TOP   
---------------------------
C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:36: [BUG] object allocation during garbage collection phase
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]

-- control frame ----------
c:0015 p:---- s:0051 b:0051 l:000050 d:000050 CFUNC  :[]
c:0014 p:0008 s:0047 b:0047 l:000028 d:000046 BLOCK  C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:36
c:0013 p:---- s:0043 b:0043 l:000042 d:000042 FINISH
c:0012 p:---- s:0041 b:0041 l:000040 d:000040 CFUNC  :each
c:0011 p:0058 s:0038 b:0038 l:000028 d:000037 BLOCK  C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:35
c:0010 p:---- s:0034 b:0034 l:000033 d:000033 FINISH
c:0009 p:---- s:0032 b:0032 l:000031 d:000031 CFUNC  :each
c:0008 p:0055 s:0029 b:0029 l:000028 d:000028 METHOD C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:32
c:0007 p:0118 s:0025 b:0025 l:000024 d:000024 METHOD C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file_manager.rb:111
c:0006 p:0065 s:0018 b:0018 l:001a3c d:000017 BLOCK  C:/workspace/netbeans/DespegarLogPreProcessor/lib/main.rb:20
c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC  :each
c:0003 p:0108 s:0008 b:0008 l:001a3c d:00193c EVAL   C:/workspace/netbeans/DespegarLogPreProcessor/lib/main.rb:13
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001a3c d:001a3c TOP   
---------------------------
-- Ruby level backtrace information-----------------------------------------
C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:36:in `[]'
C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:36:in `block (2 levels) in getrecord'
C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:35:in `each'
C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:35:in `block in getrecord'
C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:32:in `each'
C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file.rb:32:in `getrecord'
C:/workspace/netbeans/DespegarLogPreProcessor/lib/despegar_log_file_manager.rb:111:in `to_xml3'
C:/workspace/netbeans/DespegarLogPreProcessor/lib/main.rb:20:in `block in <main>'
C:/workspace/netbeans/DespegarLogPreProcessor/lib/main.rb:13:in `each'
C:/workspace/netbeans/DespegarLogPreProcessor/lib/main.rb:13:in `<main>'

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

History

Updated by Jon Forums almost 2 years ago

Please show the results of running the following commands

gem env

gem list libxml-ruby -d

Updated by Jon Forums almost 2 years ago

If you've somehow installed the x86-mswin32-60 gem in your RubyInstaller environment, the gem linked against a different Ruby version (MSVCRT-RUBY18.DLL) than the 1.9.1 version you're running.  This issue is a known cause of segfaults.

A very good XML library that uses libxml2 is Nokogiri http://nokogiri.org/ 

It is well documented, well maintained, and works well on multiple Ruby versions and implementations including Windows.  I'd highly suggest the switch.  Try it out with a simple "gem install nokogiri"

Jon

Updated by Damián D'Onia almost 2 years ago

Jon,

     These are the results for the commands that you ask for:

gem env:
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.5
  - RUBY VERSION: 1.9.1 (2010-01-10 patchlevel 378) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby19/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: C:/Ruby19/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby19/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/Ruby19/lib/ruby/gems/1.9.1
     - C:/Documents and Settings/ddonia/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/


gem list libxml-ruby -d:
libxml-ruby (1.1.3)
    Author: Charlie Savage
    Rubyforge: http://rubyforge.org/projects/libxml
    Homepage: http://libxml.rubyforge.org/
    Installed at: C:/Ruby19/lib/ruby/gems/1.9.1

    Ruby libxml bindings


Thanks in advance,

dd. //

Updated by Yusuke Endoh almost 2 years ago

  • Status changed from Open to Feedback
Hi,

Could you show your source code that triggers SEGV?

-- 
Yusuke Endoh <mame@tsg.ne.jp>

Updated by Yui NARUSE over 1 year ago

  • Status changed from Feedback to Rejected

Updated by ogechi nnadi over 1 year ago

Hi all, I'm getting the same segfault as DD above. My gem environment is as follows

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.6
  - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10]
  - INSTALLATION DIRECTORY: /opt/local/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /opt/local/bin/ruby
  - EXECUTABLE DIRECTORY: /opt/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-darwin-10
  - GEM PATHS:
     - /opt/local/lib/ruby/gems/1.8
     - /Users/ogechinnadi/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://gemcutter.org", "http://gems.rubyforge.org", "http://gems.github.com"]
     - "gem" => "--no-ri --no-rdoc"
  - REMOTE SOURCES:
     - http://gemcutter.org
     - http://gems.rubyforge.org
     - http://gems.github.com


$ gem list libxml-ruby -d

*** LOCAL GEMS ***

libxml-ruby (1.1.4)
    Author: Charlie Savage
    Rubyforge: http://rubyforge.org/projects/libxml
    Homepage: http://libxml.rubyforge.org/
    Installed at: /opt/local/lib/ruby/gems/1.8

    Ruby libxml bindings


The code that causes the crash is as follows (in IRB):

>> require 'xml'
=> true
>> document = LibXML::XML::Document.file('s.txt')
/opt/local/lib/ruby/gems/1.8/gems/libxml-ruby-1.1.4/lib/libxml/parser.rb:33: [BUG] Segmentation fault
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10]

Abort trap


I hope this helps you find the problem.

Updated by Luis Lavena over 1 year ago

Hello,

This is highly likely a 3rd party issue.

Please open a Ticket on libxml-ruby project, provide the same code and the test XML data file (s.txt) that you mention but forgot to attach.

Thank you.

Also available in: Atom PDF