[MacRuby] #895: MacRuby crashes when trying to parse an XML document with nokogiri
#895: MacRuby crashes when trying to parse an XML document with nokogiri ---------------------------+------------------------------------------------ Reporter: haxie1@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------+------------------------------------------------ Trying to parse an xml document with Nokogiri and MacRuby 0.7. The following crashes MacRuby. {{{ require 'rubygems' require 'nokogiri' xmlFile = File.open(File.expand_path(path), "r") xml = Nokogiri::XML(xmlFile) #crash }}} Here is the crash report attached. -- Ticket URL: <http://www.macruby.org/trac/ticket/895> MacRuby <http://macruby.org/>
#895: MacRuby crashes when trying to parse an XML document with nokogiri ---------------------------+------------------------------------------------ Reporter: haxie1@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------+------------------------------------------------ Comment(by watson1978@…): I think, maybe this issue is GC of MacRuby or memory allocation of nokogiri. {{{ #!ruby require 'rubygems' gem 'nokogiri' require 'nokogiri' html_doc = Nokogiri::HTML("<html><body><h1>Mr. Belvedere Fan Club</h1></body></html>") p html_doc xml_doc = Nokogiri::XML("<root><aliens><alien><name>Alf</name></alien></aliens></root>") p xml_doc }}} diff of nokogiri: {{{ #!diff diff nokogiri.c.org nokogiri.c 34,36c34,36 < (xmlFreeFunc)ruby_xfree, < (xmlMallocFunc)ruby_xmalloc, < (xmlReallocFunc)ruby_xrealloc, ---
(xmlFreeFunc)free, (xmlMallocFunc)malloc, (xmlReallocFunc)realloc,
}}} Before apply patch: {{{ $ macruby nokogiri.rb zsh: segmentation fault macruby nokogiri.rb }}} After: {{{ $ macruby nokogiri.rb #<Nokogiri::HTML::Document:0x20032b4c0 name="document" children=[#<Nokogiri::XML::DTD:0x200323300 name="html">, #<Nokogiri::XML::Element:0x2002eaa60 name="html" children=[#<Nokogiri::XML::Element:0x2002c9900 name="body" children=[#<Nokogiri::XML::Element:0x2002d8380 name="h1" children=[#<Nokogiri::XML::Text:0x2002a74e0 "Mr. Belvedere Fan Club">]>]>]>]> #<Nokogiri::XML::Document:0x2003608c0 name="document" children=[#<Nokogiri::XML::Element:0x200323b80 name="root" children=[#<Nokogiri::XML::Element:0x200364040 name="aliens" children=[#<Nokogiri::XML::Element:0x2003346e0 name="alien" children=[#<Nokogiri::XML::Element:0x20030de20 name="name" children=[#<Nokogiri::XML::Text:0x2002fa820 "Alf">]>]>]>]>]> }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/895#comment:2> MacRuby <http://macruby.org/>
#895: MacRuby crashes when trying to parse an XML document with nokogiri ---------------------------+------------------------------------------------ Reporter: haxie1@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------+------------------------------------------------ Comment(by lsansonetti@…): I wonder if the patch introduces memory leak. -- Ticket URL: <http://www.macruby.org/trac/ticket/895#comment:3> MacRuby <http://macruby.org/>
#895: MacRuby crashes when trying to parse an XML document with nokogiri ---------------------------+------------------------------------------------ Reporter: haxie1@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: invalid Keywords: | ---------------------------+------------------------------------------------ Changes (by lsansonetti@…): * status: new => closed * resolution: => invalid Comment: tenderlove confirmed that no memory leak should be introduced. Nokogiri gives pointers to the MRI GC functions to libxml so that Ruby can measure how much memory is used by libxml2 and trigger more collections. The patch has been merged in nokogiri as http://github.com/tenderlove/nokogiri/blob/master/ext/nokogiri/nokogiri.c#L2... and should ship in the next release :) -- Ticket URL: <http://www.macruby.org/trac/ticket/895#comment:4> MacRuby <http://macruby.org/>
#895: MacRuby crashes when trying to parse an XML document with nokogiri ---------------------------+------------------------------------------------ Reporter: haxie1@… | Owner: lsansonetti@… Type: defect | Status: reopened Priority: blocker | Milestone: MacRuby 0.8 Component: MacRuby | Resolution: Keywords: | ---------------------------+------------------------------------------------ Changes (by lsansonetti@…): * status: closed => reopened * resolution: invalid => * milestone: => MacRuby 0.8 Comment: Actually, this will also require r4810 for the special constant. -- Ticket URL: <http://www.macruby.org/trac/ticket/895#comment:5> MacRuby <http://macruby.org/>
#895: MacRuby crashes when trying to parse an XML document with nokogiri ---------------------------+------------------------------------------------ Reporter: haxie1@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.8 Component: MacRuby | Resolution: fixed Keywords: | ---------------------------+------------------------------------------------ Changes (by lsansonetti@…): * status: reopened => closed * resolution: => fixed -- Ticket URL: <http://www.macruby.org/trac/ticket/895#comment:6> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby