headius / spoon

A fork/exec replacement for FFI-capable implementations
Apache License 2.0
48 stars 12 forks source link

Spoon failure on JRuby 1.7.2 #10

Closed nanliu closed 11 years ago

nanliu commented 11 years ago

I haven't had a chance to dive into the changes with ffi. spoon gem works with JRuby 1.7.1, but not 1.7.2:

$ jruby-1.7.2 examples/ls.rb
RuntimeError: call method undefined
   initialize at org/jruby/ext/ffi/AutoPointer.java:122
   initialize at /Users/nan/.rvm/gems/jruby-1.7.2/gems/spoon-0.0.2/lib/spoon/unix.rb:11
       (root) at examples/ls.rb:7
headius commented 11 years ago

This appears to be an FFI issue. @wmeissner?

ghost commented 11 years ago

See the above commit. It was never working in JRuby, it was just silently failing to cleanup resources.

r4um commented 11 years ago

Does not work on MRI either spoon version 0.0.3, ffi version 1.6.0

/home/cpk/.rvm/gems/ruby-1.9.3-p392/gems/ffi-1.6.0/lib/ffi/autopointer.rb:72:in `initialize': proc must be callable (RuntimeError)
    from /home/cpk/.rvm/gems/ruby-1.9.3-p392/gems/spoon-0.0.3/lib/spoon/unix.rb:23:in `new'
    from /home/cpk/.rvm/gems/ruby-1.9.3-p392/gems/spoon-0.0.3/lib/spoon/unix.rb:23:in `initialize'
    from examples/ls.rb:20:in `new'
    from examples/ls.rb:20:in `<main>'
ghost commented 11 years ago

@r4um Copy commit b4b4877 from wmeissner/spoon to a fresh checkout of spoon master, and it should work on both.

r4um commented 11 years ago

@wmeissner thanks, After the patch causes a crash

Starting program: /home/cpk/.rvm/rubies/ruby-1.8.7-p249/bin/ruby examples/ls.rb
[Thread debugging using libthread_db enabled]
*** glibc detected *** /home/cpk/.rvm/rubies/ruby-1.8.7-p249/bin/ruby: double free or corruption (!prev): 0x0000000000abb4f0 ***

Full back trace here.

ghost commented 11 years ago

@r4um also apply commit 917c0d555592b15a65aa5af2e297283d310ea8fb - the size of the spawnattr struct was too small for 64bit linux

@headius you should probably spin a new spoon gem with these commits sometime.