A sure way to crash JRuby with Nokogiri, on Windows

L

Luc Heinrich

Greetings,

I'm sending this to Ruby-talk because I'm really not sure if the problem =
is in JRuby, Nokogiri or FFI.

So, Using JRuby 1.4.0 (standard or complete) and Nokogiri-java 1.4.1, on =
Windows, try this:

require "rubygems"
require "nokogiri"
xml =3D %Q(<?xml version=3D"1.0" encoding=3D"UTF-8"?>\n<foo =
bar=3D"baz"/>\n)
p Nokogiri::XML::Document.parse(xml)

It works.

Now try this:

require "rubygems"
require "nokogiri"
th =3D Thread.new do
xml =3D %Q(<?xml version=3D"1.0" encoding=3D"UTF-8"?>\n<foo =
bar=3D"baz"/>\n)
p Nokogiri::XML::Document.parse(xml)
end
th.join

And see it crash with an EXCEPTION_ACCESS_VIOLATION. Here's the top of =
the stack:

Stack: [0x03260000,0x032b0000], sp=3D0x032aedb4, free space=3D315k
Native frames: (J=3Dcompiled Java code, j=3Dinterpreted, Vv=3DVM code, =
C=3Dnative code)
C [ntdll.dll+0x1b21a]
C [ntdll.dll+0x1046]
j com.kenai.jffi.Foreign.invokeVrI(J)I+0
j com.kenai.jffi.Invoker.invokeVrI(Lcom/kenai/jffi/Function;)I+8
j =
org.jruby.ext.ffi.jffi.FastIntMethodZeroArg.call(Lorg/jruby/runtime/Thread=
Context;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/RubyModule;Ljava=
/lang/String;)Lorg/jruby/runtime/builtin/IRubyObject;+12
J =
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(Lorg/jruby/runtime=
/builtin/IRubyObject;Lorg/jruby/RubyClass;Lorg/jruby/runtime/ThreadContext=
;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyO=
bject;
J =
org.jruby.runtime.callsite.CachingCallSite.call(Lorg/jruby/runtime/ThreadC=
ontext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/I=
RubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
J =
org.jruby.ast.CallNoArgNode.interpret(Lorg/jruby/Ruby;Lorg/jruby/runtime/T=
hreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Blo=
ck;)Lorg/jruby/runtime/builtin/IRubyObject;
J =
org.jruby.ast.NewlineNode.interpret(Lorg/jruby/Ruby;Lorg/jruby/runtime/Thr=
eadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block=
;)Lorg/jruby/runtime/builtin/IRubyObject;
J =
org.jruby.ast.BlockNode.interpret(Lorg/jruby/Ruby;Lorg/jruby/runtime/Threa=
dContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)=
Lorg/jruby/runtime/builtin/IRubyObject;


This works just fine on OS X. Anyone has any idea what the problem is?

--=20
Luc Heinrich - (e-mail address removed)
 
C

Charles Oliver Nutter

Have you tried 1.5.0 builds? There have been a lot of fixes since 1.4.
ci.jruby.org/snapshots

(sorry for brevity sent from ps3)

- Charlie
 
M

Mike Dalessio

[Note: parts of this message were removed to make it a legal post.]

I'll take a look. I've commented on the JRuby ticket as well.

Have you tried 1.5.0 builds? There have been a lot of fixes since 1.4.
ci.jruby.org/snapshots

(sorry for brevity sent from ps3)

- Charlie

Greetings,

I'm sending this to Ruby-talk because I'm really not sure if the problem is
in JRuby, Nokogiri or FFI.

So, Using JRuby 1.4.0 (standard or complete) and Nokogiri-java 1.4.1, on
Windows, try this:

require "rubygems"
require "nokogiri"
xml = %Q(<?xml version="1.0" encoding="UTF-8"?>\n<foo bar="baz"/>\n)
p Nokogiri::XML::Document.parse(xml)

It works.

Now try this:

require "rubygems"
require "nokogiri"
th = Thread.new do
xml = %Q(<?xml version="1.0" encoding="UTF-8"?>\n<foo bar="baz"/>\n)
p Nokogiri::XML::Document.parse(xml)
end
th.join

And see it crash with an EXCEPTION_ACCESS_VIOLATION. Here's the top of the
stack:

Stack: [0x03260000,0x032b0000], sp=0x032aedb4, free space=315k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native
code)
C [ntdll.dll+0x1b21a]
C [ntdll.dll+0x1046]
j com.kenai.jffi.Foreign.invokeVrI(J)I+0
j com.kenai.jffi.Invoker.invokeVrI(Lcom/kenai/jffi/Function;)I+8
j
org.jruby.ext.ffi.jffi.FastIntMethodZeroArg.call(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/RubyModule;Ljava/lang/String;)Lorg/jruby/runtime/builtin/IRubyObject;+12
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/RubyClass;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
org.jruby.runtime.callsite.CachingCallSite.call(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
org.jruby.ast.CallNoArgNode.interpret(Lorg/jruby/Ruby;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;
org.jruby.ast.NewlineNode.interpret(Lorg/jruby/Ruby;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;
org.jruby.ast.BlockNode.interpret(Lorg/jruby/Ruby;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;


This works just fine on OS X. Anyone has any idea what the problem is?
 
M

Mike Dalessio

[Note: parts of this message were removed to make it a legal post.]

Greetings,

I'm sending this to Ruby-talk because I'm really not sure if the problem is
in JRuby, Nokogiri or FFI.

So, Using JRuby 1.4.0 (standard or complete) and Nokogiri-java 1.4.1, on
Windows, try this:


This works just fine on OS X. Anyone has any idea what the problem is?

This appears to be an issue with the libxml2 DLL shipped with Nokogiri's
JRuby gem.

You can follow along at:
http://github.com/tenderlove/nokogiri/issues/#issue/248
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top