From: robert gleeson Date: 2009-09-16T19:29:50+09:00 Subject: [ruby-core:25610] [Bug #2104] Ruby 1.9p129, Segmentation Fault. Bug #2104: Ruby 1.9p129, Segmentation Fault. http://redmine.ruby-lang.org/issues/show/2104 Author: robert gleeson Status: Open, Priority: Normal ruby -v: ruby 1.9.1p129 (2009-05-12 revision 23412) [x86_64-linux] Hi, I may have encountered a bug in ruby, or in nokogiri, which has C extensions written. I'm not sure. My C foo is too weak. I think I've collected all the relevant information & hopefully it may help if it is a bug. The code in question is: ## method at fault def parse_content xmldoc = Nokogiri::XML @str.body xmldoc.xpath("//").each do |x| puts x end end The stacktrace returned is: ## stacktrace robert@okiwana:~/Projects/importer$ ruby19 import.rb /opt/ruby1.9.1p129/lib/ruby19/gems/1.9.1/gems/nokogiri-1.3.3/lib/nokogiri/xml/node.rb:140:in `evaluate': Invalid expression (Nokogiri::XML::XPath::SyntaxError) from /opt/ruby1.9.1p129/lib/ruby19/gems/1.9.1/gems/nokogiri-1.3.3/lib/nokogiri/xml/node.rb:140:in `block in xpath' from /opt/ruby1.9.1p129/lib/ruby19/gems/1.9.1/gems/nokogiri-1.3.3/lib/nokogiri/xml/node.rb:137:in `map' from /opt/ruby1.9.1p129/lib/ruby19/gems/1.9.1/gems/nokogiri-1.3.3/lib/nokogiri/xml/node.rb:137:in `xpath' from import.rb:39:in `parse_content' from import.rb:55:in `
'
:357: [BUG] Segmentation fault ruby 1.9.1p129 (2009-05-12 revision 23412) [x86_64-linux] -- control frame ---------- c:0001 p:0000 s:0002 b:0002 l:0024c8 d:0024c8 TOP
:357 --------------------------- -- Ruby level backtrace information----------------------------------------- -- C level backtrace information ------------------------------------------- 0x4e8e3b ruby19(rb_vm_bugreport+0x3b) [0x4e8e3b] 0x517080 ruby19 [0x517080] 0x5171f1 ruby19(rb_bug+0xb1) [0x5171f1] 0x493bbf ruby19 [0x493bbf] 0x7f4993247190 /lib/libpthread.so.0 [0x7f4993247190] 0x443352 ruby19(rb_obj_is_kind_of+0x122) [0x443352] 0x41aacf ruby19(ruby_cleanup+0x1cf) [0x41aacf] 0x41abaa ruby19(ruby_run_node+0x3a) [0x41abaa] 0x417f5d ruby19(main+0x4d) [0x417f5d] 0x7f499261eabd /lib/libc.so.6(__libc_start_main+0xfd) [0x7f499261eabd] 0x417e49 ruby19 [0x417e49] [NOTE] You may encounter a bug of Ruby interpreter. Bug reports are welcome. For details: http://www.ruby-lang.org/bugreport.html Aborted (core dumped) ## gdb output Program received signal SIGSEGV, Segmentation fault. 0x000000000044335e in rb_obj_is_kind_of (obj=36993720, c=31215080) at object.c:468 468 cl = RCLASS_SUPER(cl); (gdb) backtrace #0 0x000000000044335e in rb_obj_is_kind_of (obj=36993720, c=31215080) at object.c:468 #1 0x000000000041aacf in ruby_cleanup (ex=1) at eval.c:169 #2 0x000000000041abaa in ruby_run_node (n=0x1ec7d58) at eval.c:234 #3 0x0000000000417f5d in main (argc=2, argv=0x7fff20649758) at main.c:35 Sorry, I don't know nokogiri code that causes this exactly, but it seems straight after an exception is raised, the segfault occurs. I hope this helps. Thanks. ---------------------------------------- http://redmine.ruby-lang.org