Regression in cext after JRuby 1.7.2 #594

Closed
DimaSavitsky opened this Issue Mar 19, 2013 · 5 comments

Comments

Projects
None yet
5 participants

First of all, the error itself:

$ bundle exec rake -T
rake aborted!
load error: pg_ext -- java.lang.RuntimeException: C extension initialized against invalid ruby runtime
org/jruby/RubyKernel.java:1027:in `require'
/home/dmitry/.rvm/gems/jruby-head/gems/pg-0.14.1/lib/pg.rb:4:in `(root)'
org/jruby/RubyKernel.java:1027:in `require'
/home/dmitry/.rvm/gems/jruby-head/gems/bundler-1.3.4/lib/bundler/runtime.rb:1:in `(root)'
org/jruby/RubyArray.java:1613:in `each'
/home/dmitry/.rvm/gems/jruby-head/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `require'
org/jruby/RubyArray.java:1613:in `each'
/home/dmitry/.rvm/gems/jruby-head/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `require'
/home/dmitry/.rvm/gems/jruby-head/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `require'
/home/dmitry/.rvm/gems/jruby-head/gems/bundler-1.3.4/lib/bundler.rb:132:in `require'
org/jruby/RubyKernel.java:1027:in `require'
/home/dmitry/Work/crossArts/config/application.rb:13:in `(root)'
org/jruby/RubyKernel.java:1046:in `load'
/home/dmitry/Work/crossArts/Rakefile:1:in `(root)'
/home/dmitry/Work/crossArts/Rakefile:5:in `(root)'
org/jruby/RubyKernel.java:1046:in `load'
org/jruby/RubyKernel.java:1066:in `eval'
/home/dmitry/.rvm/gems/jruby-head/bin/ruby_noexec_wrapper:14:in `(root)'

On our project we are running on gem pg_power (which is compatible only with pg gem and not with jdbc adapter). For clearance we tested with mysql2 gem and get the same result.

After bisecting we found that the problem is caused by: 3b8b934

To reproduce the bug you can use: jruby_ffi_regression_test

@headius can you please take a look?

@ghost

ghost commented Mar 19, 2013

This looks like a problem with cext, not FFI.

We are getting a similar error trying to use foreman. The exception is the same, except it references the posix_spawn_ext gem rather than pg_ext.

It was working fine for us in 1.7.0.

Owner

headius commented Apr 3, 2013

Unfortunately C extension support is no longer supported. We plan to spin it off as an external project that users can maintain if they so desire.

The issue here looks like you've got multiple JRuby instances in one JVM and more than one of them is trying to load C extensions. The MRI C ext API is 100% incompatible with multiple JRuby instances in the same process, due to their use of C-level global variables and inability to know which instance is making a call into C. Could you perhaps be booting multiple JRuby instances? Maybe you're running Trinidad, which spins up multiple instances by default?

For us, we were just running a "foreman start". I'm not really sure what posix-spawn does internally, but I suppose it is possible it is somehow starting multiple copies of JRuby.

styx commented Apr 4, 2013

@headius yep, you are right, we are using puma which runs a bunch of jRuby instances

Owner

chrisseaton commented Oct 7, 2014

The C extension support has moved to https://github.com/jruby/jruby-cext. If you are still having a problem, please recreate this issue there. However I believe the general opinion is that the core team does not have the resources to maintain C extension support at the moment. Sorry.

@chrisseaton chrisseaton closed this Oct 7, 2014

@chrisseaton chrisseaton added this to the Won't Fix milestone Oct 7, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment