BSON C Extension causes jRuby to segfault -----------------------------------------
Key: JRUBY-5182 URL: http://jira.codehaus.org/browse/JRUBY-5182 Project: JRuby Issue Type: Bug Components: C Extensions Affects Versions: JRuby 1.6 Environment: Mac OS X Reporter: Eric Lubow Assignee: Thomas E Enebo The BSON C extension doesn't appear to work in jRuby 1.6-HEAD. ## Code require 'rubygems' require 'mongo' require 'benchmark' database = Mongo::Connection.new('localhost', 27017).db("simplereach_website_development") 100_000.times { database['live_ads'].find({}).to_a } Benchmark.bm do |x| x.report("parse:") { database['live_ads'].find({}).to_a } end ## Changes to bson-1.1.2/lib/bson.rb to force use of BSON C extension by Mongo Ruby Driver -- 35 if RUBY_PLATFORM =~ /java/ ++ 35 if false 36 jar_dir = File.join(File.dirname(__FILE__), '..', 'ext', 'java', 'jar') 37 require File.join(jar_dir, 'mongo-2.2.jar') ## Compile Mode FORCE elu...@beacon bson_ext$ jruby -J-Djruby.compile.mode=FORCE -S find.rb calling init (1027b4540) JRuby.java:70:in `callRubyMethod0': java.lang.NullPointerException from Native.java:-2:in `callMethod1' from NativeMethod1.java:48:in `call' from WrapperMethod.java:58:in `call' from CachingCallSite.java:150:in `call' from bson_c.rb:28:in `method__3$RUBY$deserialize' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_bson_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_bson_bson_cInvokermethod__3$RUBY$deserializeOpt#deserialize:65535:in `call' from DynamicMethod.java:192:in `call' from CompiledMethod.java:218:in `call' from CachingCallSite.java:150:in `call' from connection.rb:816:in `method__56$RUBY$read_documents' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_connectionInvokermethod__56$RUBY$read_documentsFixed3#read_documents:65535:in `call' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_connectionInvokermethod__56$RUBY$read_documentsFixed3#read_documents:65535:in `call' from CachingCallSite.java:230:in `call' from connection.rb:761:in `method__51$RUBY$receive' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_connectionInvokermethod__51$RUBY$receiveFixed1#receive:65535:in `call' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_connectionInvokermethod__51$RUBY$receiveFixed1#receive:65535:in `call' from CachingCallSite.java:150:in `call' from connection.rb:466:in `block_10$RUBY$__block__' from null:65535:in `call' from CompiledBlock.java:115:in `yield' from CompiledBlock.java:98:in `yield' from Block.java:194:in `yield' from ThreadLibrary.java:196:in `synchronize' from org/jruby/libraries/ThreadLibrary$Mutex$i_method_0_0$RUBYINVOKER$synchronize.gen:65535:in `call' from CachingCallSite.java:119:in `callBlock' from CachingCallSite.java:136:in `callIter' from connection.rb:464:in `ensure_3$RUBY$__ensure___27' from connection.rb:460:in `method__26$RUBY$receive_message' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_connectionInvokermethod__26$RUBY$receive_messageOpt#receive_message:65535:in `call' from DynamicMethod.java:162:in `call' from CachingCallSite.java:70:in `call' from cursor.rb:371:in `method__22$RUBY$send_initial_query' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_cursorInvokermethod__22$RUBY$send_initial_queryFixed0#send_initial_query:65535:in `call' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_cursorInvokermethod__22$RUBY$send_initial_queryFixed0#send_initial_query:65535:in `call' from CachingCallSite.java:110:in `call' from cursor.rb:337:in `method__21$RUBY$refresh' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_cursorInvokermethod__21$RUBY$refreshFixed0#refresh:65535:in `call' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_cursorInvokermethod__21$RUBY$refreshFixed0#refresh:65535:in `call' from CachingCallSite.java:110:in `call' from cursor.rb:66:in `method__3$RUBY$next_document' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_cursorInvokermethod__3$RUBY$next_documentFixed0#next_document:65535:in `call' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_cursorInvokermethod__3$RUBY$next_documentFixed0#next_document:65535:in `call' from CachingCallSite.java:110:in `call' from cursor.rb:218:in `method__11$RUBY$each' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_cursorInvokermethod__11$RUBY$eachFixed0#each:65535:in `call' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_cursorInvokermethod__11$RUBY$eachFixed0#each:65535:in `call' from RubyClass.java:540:in `finvoke' from RuntimeHelpers.java:450:in `invoke' from RubyEnumerable.java:360:in `to_a' from org/jruby/RubyEnumerable$s_method_multi$RUBYINVOKER$to_a.gen:65535:in `call' from JavaMethod.java:642:in `call' from SuperCallSite.java:68:in `callBlock' from SuperCallSite.java:75:in `call' from cursor.rb:236:in `method__12$RUBY$to_a' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_cursorInvokermethod__12$RUBY$to_aFixed0#to_a:65535:in `call' from Users_elubow_$_dot_rvm_gems_jruby_minus_head_40_bson_ext_minus_bm_gems_mongo_minus_1_dot_1_dot_2_lib_$_dot_dot__lib_mongo_cursorInvokermethod__12$RUBY$to_aFixed0#to_a:65535:in `call' from CachingCallSite.java:110:in `call' from find.rb:7:in `block_0$RUBY$__block__' from null:65535:in `call' from CompiledBlock.java:115:in `yield' from CompiledBlock.java:98:in `yield' from Block.java:194:in `yield' from RubyFixnum.java:250:in `times' from org/jruby/RubyInteger$i_method_0_0$RUBYFRAMEDINVOKER$times.gen:65535:in `call' from CachingCallSite.java:303:in `cacheAndCall' from CachingCallSite.java:121:in `callBlock' from CachingCallSite.java:136:in `callIter' from find.rb:7:in `__file__' from find.rb:-1:in `load' from Ruby.java:686:in `runScript' from Ruby.java:569:in `runNormally' from Ruby.java:412:in `runFromMain' from Main.java:304:in `run' from Main.java:144:in `run' from Main.java:113:in `main' ## Error compile mode elu...@beacon bson_ext$ jruby -J-Djruby.compile.mode=OFF -S find.rb calling init (12e7e6540) JRuby.java:70:in `callRubyMethod0': java.lang.NullPointerException from Native.java:-2:in `callMethod1' from NativeMethod1.java:48:in `call' from WrapperMethod.java:58:in `call' from CachingCallSite.java:150:in `call' from bson_c.rb:28:in `__file__' from bson_c.rb:-1:in `__file__' from AbstractScript.java:39:in `__file__' from JittedMethod.java:153:in `call' from CachingCallSite.java:150:in `call' from CallOneArgNode.java:57:in `interpret' from CallOneArgNode.java:57:in `interpret' from NewlineNode.java:104:in `interpret' from BlockNode.java:71:in `interpret' from WhileNode.java:131:in `interpret' from NewlineNode.java:104:in `interpret' from BlockNode.java:71:in `interpret' from InterpretedMethod.java:262:in `call' from DefaultMethod.java:206:in `call' from CachingCallSite.java:230:in `call' from FCallThreeArgNode.java:40:in `interpret' from NewlineNode.java:104:in `interpret' from BlockNode.java:71:in `interpret' from InterpretedMethod.java:180:in `call' from DefaultMethod.java:174:in `call' from CachingCallSite.java:150:in `call' from FCallOneArgNode.java:36:in `interpret' from LocalAsgnNode.java:123:in `interpret' from NewlineNode.java:104:in `interpret' from BlockNode.java:71:in `interpret' from InterpretedBlock.java:373:in `evalBlockBody' from InterpretedBlock.java:346:in `yield' from InterpretedBlock.java:303:in `yield' from Block.java:194:in `yield' from ThreadLibrary.java:196:in `synchronize' from org/jruby/libraries/ThreadLibrary$Mutex$i_method_0_0$RUBYINVOKER$synchronize.gen:65535:in `call' from CachingCallSite.java:119:in `callBlock' from CachingCallSite.java:126:in `call' from CallNoArgBlockNode.java:64:in `interpret' from NewlineNode.java:104:in `interpret' from BlockNode.java:71:in `interpret' from EnsureNode.java:96:in `interpret' from BeginNode.java:83:in `interpret' from NewlineNode.java:104:in `interpret' from BlockNode.java:71:in `interpret' from InterpretedMethod.java:113:in `call' from InterpretedMethod.java:127:in `call' from DefaultMethod.java:149:in `call' from CachingCallSite.java:70:in `call' from CallManyArgsNode.java:59:in `interpret' from ToAryNode.java:69:in `interpret' from MultipleAsgnNode.java:127:in `interpret' from NewlineNode.java:104:in `interpret' from BlockNode.java:71:in `interpret' from IfNode.java:119:in `interpret' from NewlineNode.java:104:in `interpret' from InterpretedMethod.java:139:in `call' from DefaultMethod.java:158:in `call' from CachingCallSite.java:110:in `call' from VCallNode.java:85:in `interpret' from OrNode.java:94:in `interpret' from IfNode.java:111:in `interpret' from NewlineNode.java:104:in `interpret' from BlockNode.java:71:in `interpret' from InterpretedMethod.java:139:in `call' from DefaultMethod.java:158:in `call' from CachingCallSite.java:110:in `call' from cursor.rb:66:in `__file__' from cursor.rb:-1:in `__file__' from JittedMethod.java:119:in `call' from CachingCallSite.java:110:in `call' from VCallNode.java:85:in `interpret' from LocalAsgnNode.java:123:in `interpret' from WhileNode.java:127:in `interpret' from NewlineNode.java:104:in `interpret' from InterpretedMethod.java:113:in `call' from DefaultMethod.java:140:in `call' from RubyClass.java:540:in `finvoke' from RuntimeHelpers.java:450:in `invoke' from RubyEnumerable.java:360:in `to_a' from org/jruby/RubyEnumerable$s_method_multi$RUBYINVOKER$to_a.gen:65535:in `call' from JavaMethod.java:642:in `call' from SuperCallSite.java:68:in `callBlock' from SuperCallSite.java:75:in `call' from ZSuperNode.java:100:in `interpret' from NewlineNode.java:104:in `interpret' from InterpretedMethod.java:139:in `call' from DefaultMethod.java:158:in `call' from CachingCallSite.java:110:in `call' from find.rb:7:in `block_0$RUBY$__block__' from null:65535:in `call' from CompiledBlock.java:115:in `yield' from CompiledBlock.java:98:in `yield' from Block.java:194:in `yield' from RubyFixnum.java:250:in `times' from org/jruby/RubyInteger$i_method_0_0$RUBYFRAMEDINVOKER$times.gen:65535:in `call' from CachingCallSite.java:303:in `cacheAndCall' from CachingCallSite.java:121:in `callBlock' from CachingCallSite.java:136:in `callIter' from find.rb:7:in `__file__' from find.rb:-1:in `load' from Ruby.java:686:in `runScript' from Ruby.java:569:in `runNormally' from Ruby.java:412:in `runFromMain' from Main.java:304:in `run' from Main.java:144:in `run' from Main.java:113:in `main' -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email