NullPointerException bug: openssl.Digest #1000

Closed
greghuc opened this Issue Sep 10, 2013 · 8 comments

Projects

None yet

4 participants

@greghuc
greghuc commented Sep 10, 2013

Hi there,

I'm having issues running Rails 4 on JRuby 1.7.5 head (2013-09-10)

After running some traffic against a vanilla Rails app, I start seeing a NullPointerException concerning org.jruby.ext.openssl.Digest.getAlgorithm. Full trace below.

My setup:

  • Mac OS X 10.8.4
  • Java 1.7.0_40
  • JRuby head, cloned from github today.
  • Rails 4, vanilla install. I then created a WelcomeController with an empty index method
  • Puma web server

To reproduce:

Exception trace:

Java::JavaLang::NullPointerException ():
  org.jruby.ext.openssl.Digest.getAlgorithm(Digest.java:229)
  org.jruby.ext.openssl.Digest.getShortAlgorithm(Digest.java:233)
  org.jruby.ext.openssl.HMAC.getDigestAlgorithmName(HMAC.java:182)
  org.jruby.ext.openssl.HMAC.s_hexdigest(HMAC.java:91)
  org.jruby.ext.openssl.HMAC$INVOKER$s$3$0$s_hexdigest.call(HMAC$INVOKER$s$3$0$s_hexdigest.gen)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:236)
  rubyjit.ActiveSupport::MessageVerifier$$generate_digest_5EB7C6F0472E122CDD02D4C578A1AA0A035BD77E2064659473.__file__(activesupport (4.0.0) lib/active_support/message_verifier.rb:65)
  rubyjit.ActiveSupport::MessageVerifier$$generate_digest_5EB7C6F0472E122CDD02D4C578A1AA0A035BD77E2064659473.__file__(activesupport (4.0.0) lib/active_support/message_verifier.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.ActiveSupport::MessageVerifier$$generate_CA236BC5BF666FB24FC2AFBA89A22A478664454E2064659473.__file__(activesupport (4.0.0) lib/active_support/message_verifier.rb:48)
  rubyjit.ActiveSupport::MessageVerifier$$generate_CA236BC5BF666FB24FC2AFBA89A22A478664454E2064659473.__file__(activesupport (4.0.0) lib/active_support/message_verifier.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.ActiveSupport::MessageEncryptor$$encrypt_and_sign_51FA746F7364937E8529F538E4ED94BF40ED677B2064659473.__file__(activesupport (4.0.0) lib/active_support/message_encryptor.rb:57)
  rubyjit.ActiveSupport::MessageEncryptor$$encrypt_and_sign_51FA746F7364937E8529F538E4ED94BF40ED677B2064659473.__file__(activesupport (4.0.0) lib/active_support/message_encryptor.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.ActionDispatch::Cookies::EncryptedCookieJar$$\=\{\}=_360A7CA564E062924C865851C6CAFADA592324B42064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:453)
  rubyjit.ActionDispatch::Cookies::EncryptedCookieJar$$\=\{\}=_360A7CA564E062924C865851C6CAFADA592324B42064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:221)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
  rubyjit.ActionDispatch::Session::CookieStore$$set_cookie_5DBEF07644E009D75A96EA82BC42A6C1E2B694DB2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/session/cookie_store.rb:109)
  rubyjit.ActionDispatch::Session::CookieStore$$set_cookie_5DBEF07644E009D75A96EA82BC42A6C1E2B694DB2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/session/cookie_store.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:261)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:236)
  rubyjit.Rack::Session::Abstract::ID$$commit_session_68C4E61B2C4E43C0A408FE8D76920DC006D78F142064659473.__file__(rack (1.5.2) lib/rack/session/abstract/id.rb:350)
  rubyjit.Rack::Session::Abstract::ID$$commit_session_68C4E61B2C4E43C0A408FE8D76920DC006D78F142064659473.__file__(rack (1.5.2) lib/rack/session/abstract/id.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:121)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:70)
  rubyjit.Rack::Session::Abstract::ID$$context_A7A7DEE297900413632F0FB43FC05AD3FCFB09E22064659473.__file__(rack (1.5.2) lib/rack/session/abstract/id.rb:226)
  rubyjit.Rack::Session::Abstract::ID$$context_A7A7DEE297900413632F0FB43FC05AD3FCFB09E22064659473.__file__(rack (1.5.2) lib/rack/session/abstract/id.rb)
  org.jruby.ast.executable.AbstractScript.__file__(AbstractScript.java:42)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.Rack::Session::Abstract::ID$$call_E0B5EF46CE65217453BD33BFF64649DDEB38BA842064659473.__file__(rack (1.5.2) lib/rack/session/abstract/id.rb:220)
  rubyjit.Rack::Session::Abstract::ID$$call_E0B5EF46CE65217453BD33BFF64649DDEB38BA842064659473.__file__(rack (1.5.2) lib/rack/session/abstract/id.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.ActionDispatch::Cookies$$call_8D8F01678A9E9DD5FC7679DF4A5D8FAF52DEE4EC2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486)
  rubyjit.ActionDispatch::Cookies$$call_8D8F01678A9E9DD5FC7679DF4A5D8FAF52DEE4EC2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.ActionDispatch::Callbacks$$call_44D918E52939297A3DF24D4CE97A527DA0F4A2BF2064659473.chained_0_rescue_1$RUBY$SYNTHETIC__file__(actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29)
  rubyjit.ActionDispatch::Callbacks$$call_44D918E52939297A3DF24D4CE97A527DA0F4A2BF2064659473.block_0$RUBY$__file__(actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:28)
  rubyjit$ActionDispatch::Callbacks$$call_44D918E52939297A3DF24D4CE97A527DA0F4A2BF2064659473$block_0$RUBY$__file__.call(rubyjit$ActionDispatch::Callbacks$$call_44D918E52939297A3DF24D4CE97A527DA0F4A2BF2064659473$block_0$RUBY$__file__)
  org.jruby.runtime.CompiledBlock19.yieldSpecificInternal(CompiledBlock19.java:117)
  org.jruby.runtime.CompiledBlock19.yieldSpecific(CompiledBlock19.java:92)
  org.jruby.runtime.Block.yieldSpecific(Block.java:111)
  rubyjit.ActionDispatch::Callbacks$$_run__1504883521__call__callbacks_224CB797CFBCA81ED93D69FAE36FD9BB143B89B12064659473.__file__(activesupport (4.0.0) lib/active_support/callbacks.rb:376)
  rubyjit.ActionDispatch::Callbacks$$_run__1504883521__call__callbacks_224CB797CFBCA81ED93D69FAE36FD9BB143B89B12064659473.__file__(activesupport (4.0.0) lib/active_support/callbacks.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:161)
  org.jruby.RubyClass.finvoke(RubyClass.java:527)
  org.jruby.RubyBasicObject.send19(RubyBasicObject.java:1504)
  org.jruby.RubyKernel.send19(RubyKernel.java:2238)
  org.jruby.RubyKernel$INVOKER$s$send19.call(RubyKernel$INVOKER$s$send19.gen)
  org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:177)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:183)
  rubyjit.ActiveSupport::Callbacks$$run_callbacks_C5403E8D2FBE813CF91BE7D34910AA8EE4A0430C2064659473.__file__(activesupport (4.0.0) lib/active_support/callbacks.rb:80)
  rubyjit.ActiveSupport::Callbacks$$run_callbacks_C5403E8D2FBE813CF91BE7D34910AA8EE4A0430C2064659473.__file__(activesupport (4.0.0) lib/active_support/callbacks.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:201)
  org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:177)
  org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:188)
  rubyjit.ActionDispatch::Callbacks$$call_44D918E52939297A3DF24D4CE97A527DA0F4A2BF2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27)
  rubyjit.ActionDispatch::Callbacks$$call_44D918E52939297A3DF24D4CE97A527DA0F4A2BF2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.ActionDispatch::RemoteIp$$call_AB076CF5395364D2B109D71AF1C13027C0854B4B2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76)
  rubyjit.ActionDispatch::RemoteIp$$call_AB076CF5395364D2B109D71AF1C13027C0854B4B2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.ActionDispatch::DebugExceptions$$call_BDC64F800DAA3D6597980D138667119C33A3770A2064659473.chained_0_rescue_1$RUBY$SYNTHETIC__file__(actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17)
  rubyjit.ActionDispatch::DebugExceptions$$call_BDC64F800DAA3D6597980D138667119C33A3770A2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb)
  rubyjit.ActionDispatch::DebugExceptions$$call_BDC64F800DAA3D6597980D138667119C33A3770A2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.ActionDispatch::ShowExceptions$$call_31FE6C13D5680F23AE39DC9B80DFF23E9243585E2064659473.chained_0_rescue_1$RUBY$SYNTHETIC__file__(actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30)
  rubyjit.ActionDispatch::ShowExceptions$$call_31FE6C13D5680F23AE39DC9B80DFF23E9243585E2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb)
  rubyjit.ActionDispatch::ShowExceptions$$call_31FE6C13D5680F23AE39DC9B80DFF23E9243585E2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.Rails::Rack::Logger$$call_app_F469967EC934EE30FC1CF689535A5D56958F75F42064659473.chained_1_rescue_1$RUBY$SYNTHETIC__file__(railties (4.0.0) lib/rails/rack/logger.rb:38)
  rubyjit.Rails::Rack::Logger$$call_app_F469967EC934EE30FC1CF689535A5D56958F75F42064659473.chained_0_ensure_1$RUBY$__ensure__(railties (4.0.0) lib/rails/rack/logger.rb)
  rubyjit.Rails::Rack::Logger$$call_app_F469967EC934EE30FC1CF689535A5D56958F75F42064659473.__file__(railties (4.0.0) lib/rails/rack/logger.rb)
  rubyjit.Rails::Rack::Logger$$call_app_F469967EC934EE30FC1CF689535A5D56958F75F42064659473.__file__(railties (4.0.0) lib/rails/rack/logger.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:221)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
  rubyjit.Rails::Rack::Logger$$call_63F7D6C2717BCEDED51FC6B89F4E3B4B323BFEBB2064659473.block_0$RUBY$__file__(railties (4.0.0) lib/rails/rack/logger.rb:21)
  rubyjit$Rails::Rack::Logger$$call_63F7D6C2717BCEDED51FC6B89F4E3B4B323BFEBB2064659473$block_0$RUBY$__file__.call(rubyjit$Rails::Rack::Logger$$call_63F7D6C2717BCEDED51FC6B89F4E3B4B323BFEBB2064659473$block_0$RUBY$__file__)
  org.jruby.runtime.CompiledBlock19.yield(CompiledBlock19.java:135)
  org.jruby.runtime.CompiledBlock19.yieldSpecific(CompiledBlock19.java:97)
  org.jruby.runtime.Block.yieldSpecific(Block.java:120)
  rubyjit.ActiveSupport::TaggedLogging$$tagged_1089BBCC4782E767FE1F9B1EED8B72F5E44343CD2064659473.block_0$RUBY$__file__(activesupport (4.0.0) lib/active_support/tagged_logging.rb:67)
  rubyjit$ActiveSupport::TaggedLogging$$tagged_1089BBCC4782E767FE1F9B1EED8B72F5E44343CD2064659473$block_0$RUBY$__file__.call(rubyjit$ActiveSupport::TaggedLogging$$tagged_1089BBCC4782E767FE1F9B1EED8B72F5E44343CD2064659473$block_0$RUBY$__file__)
  org.jruby.runtime.CompiledBlock19.yield(CompiledBlock19.java:135)
  org.jruby.runtime.CompiledBlock19.yieldSpecific(CompiledBlock19.java:97)
  org.jruby.runtime.Block.yieldSpecific(Block.java:120)
  rubyjit.ActiveSupport::TaggedLogging::Formatter$$tagged_D6F6F3A91DF1B2819C788E9A3D6A99B972E1823A2064659473.chained_0_ensure_1$RUBY$__ensure__(activesupport (4.0.0) lib/active_support/tagged_logging.rb:25)
  rubyjit.ActiveSupport::TaggedLogging::Formatter$$tagged_D6F6F3A91DF1B2819C788E9A3D6A99B972E1823A2064659473.__file__(activesupport (4.0.0) lib/active_support/tagged_logging.rb)
  rubyjit.ActiveSupport::TaggedLogging::Formatter$$tagged_D6F6F3A91DF1B2819C788E9A3D6A99B972E1823A2064659473.__file__(activesupport (4.0.0) lib/active_support/tagged_logging.rb)
  org.jruby.ast.executable.AbstractScript.__file__(AbstractScript.java:42)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:201)
  org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:177)
  org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:188)
  org.jruby.runtime.callsite.CachingCallSite.callVarargsIter(CachingCallSite.java:123)
  rubyjit.ActiveSupport::TaggedLogging$$tagged_1089BBCC4782E767FE1F9B1EED8B72F5E44343CD2064659473.__file__(activesupport (4.0.0) lib/active_support/tagged_logging.rb:67)
  rubyjit.ActiveSupport::TaggedLogging$$tagged_1089BBCC4782E767FE1F9B1EED8B72F5E44343CD2064659473.__file__(activesupport (4.0.0) lib/active_support/tagged_logging.rb)
  org.jruby.ast.executable.AbstractScript.__file__(AbstractScript.java:42)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:201)
  org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:177)
  org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:188)
  rubyjit.Rails::Rack::Logger$$call_63F7D6C2717BCEDED51FC6B89F4E3B4B323BFEBB2064659473.__file__(railties (4.0.0) lib/rails/rack/logger.rb:21)
  rubyjit.Rails::Rack::Logger$$call_63F7D6C2717BCEDED51FC6B89F4E3B4B323BFEBB2064659473.__file__(railties (4.0.0) lib/rails/rack/logger.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.ActionDispatch::RequestId$$call_0B253B1D1D557F47B6E4899F7F49A276A4E298FC2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21)
  rubyjit.ActionDispatch::RequestId$$call_0B253B1D1D557F47B6E4899F7F49A276A4E298FC2064659473.__file__(actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.Rack::MethodOverride$$call_5C4513A64D983C8019F0C2940E049E8355465D212064659473.__file__(rack (1.5.2) lib/rack/methodoverride.rb:21)
  rubyjit.Rack::MethodOverride$$call_5C4513A64D983C8019F0C2940E049E8355465D212064659473.__file__(rack (1.5.2) lib/rack/methodoverride.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.Rack::Runtime$$call_244B79C785429BA6E33FD2DDEFEAE75AD1BF33972064659473.__file__(rack (1.5.2) lib/rack/runtime.rb:17)
  rubyjit.Rack::Runtime$$call_244B79C785429BA6E33FD2DDEFEAE75AD1BF33972064659473.__file__(rack (1.5.2) lib/rack/runtime.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.ActiveSupport::Cache::Strategy::LocalCache::Middleware$$call_CA599E122487553889A8D3237DC8C5EE6FBB453C2064659473.chained_0_ensure_1$RUBY$__ensure__(activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83)
  rubyjit.ActiveSupport::Cache::Strategy::LocalCache::Middleware$$call_CA599E122487553889A8D3237DC8C5EE6FBB453C2064659473.__file__(activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb)
  rubyjit.ActiveSupport::Cache::Strategy::LocalCache::Middleware$$call_CA599E122487553889A8D3237DC8C5EE6FBB453C2064659473.__file__(activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.Rails::Engine$$call_49567B0DA860AC24D56FB8C30269359848A7CCBD2064659473.__file__(railties (4.0.0) lib/rails/engine.rb:511)
  rubyjit.Rails::Engine$$call_49567B0DA860AC24D56FB8C30269359848A7CCBD2064659473.__file__(railties (4.0.0) lib/rails/engine.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:201)
  org.jruby.runtime.callsite.SuperCallSite.callBlock(SuperCallSite.java:190)
  org.jruby.runtime.callsite.SuperCallSite.call(SuperCallSite.java:197)
  rubyjit.Rails::Application$$call_4437EC33BCB74F63E0D10D46053F4A0C0C01235A2064659473.__file__(railties (4.0.0) lib/rails/application.rb:97)
  rubyjit.Rails::Application$$call_4437EC33BCB74F63E0D10D46053F4A0C0C01235A2064659473.__file__(railties (4.0.0) lib/rails/application.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.Rack::ContentLength$$call_A3183C350EF3BF2EB2B4634E8C32199FDFFB023B2064659473.__file__(rack (1.5.2) lib/rack/content_length.rb:14)
  rubyjit.Rack::ContentLength$$call_A3183C350EF3BF2EB2B4634E8C32199FDFFB023B2064659473.__file__(rack (1.5.2) lib/rack/content_length.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:181)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  rubyjit.Puma::Server$$handle_request_A96F41FCF799079F5E8D7C7ECC0083CB3F7FB1FF2064659473.chained_1_rescue_1$RUBY$SYNTHETIC__file__(puma-2.5.1 (java) lib/puma/server.rb:472)
  rubyjit.Puma::Server$$handle_request_A96F41FCF799079F5E8D7C7ECC0083CB3F7FB1FF2064659473.chained_0_ensure_1$RUBY$__ensure__(puma-2.5.1 (java) lib/puma/server.rb:471)
  rubyjit.Puma::Server$$handle_request_A96F41FCF799079F5E8D7C7ECC0083CB3F7FB1FF2064659473.__file__(puma-2.5.1 (java) lib/puma/server.rb:470)
  rubyjit.Puma::Server$$handle_request_A96F41FCF799079F5E8D7C7ECC0083CB3F7FB1FF2064659473.__file__(puma-2.5.1 (java) lib/puma/server.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:221)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
  rubyjit.Puma::Server$$process_client_51B4501CE7E3E978912D2178934A94BB12C28CC32064659473.chained_1_rescue_1$RUBY$SYNTHETIC__file__(puma-2.5.1 (java) lib/puma/server.rb:343)
  rubyjit.Puma::Server$$process_client_51B4501CE7E3E978912D2178934A94BB12C28CC32064659473.chained_0_ensure_1$RUBY$__ensure__(puma-2.5.1 (java) lib/puma/server.rb)
  rubyjit.Puma::Server$$process_client_51B4501CE7E3E978912D2178934A94BB12C28CC32064659473.__file__(puma-2.5.1 (java) lib/puma/server.rb:339)
  rubyjit.Puma::Server$$process_client_51B4501CE7E3E978912D2178934A94BB12C28CC32064659473.__file__(puma-2.5.1 (java) lib/puma/server.rb)
  org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:221)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
  org.jruby.ast.FCallTwoArgNode.interpret(FCallTwoArgNode.java:38)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.IfNode.interpret(IfNode.java:116)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.RescueNode.interpret(RescueNode.java:159)
  org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
  org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
  org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:194)
  org.jruby.runtime.Interpreted19Block.call(Interpreted19Block.java:125)
  org.jruby.runtime.Block.call(Block.java:101)
  org.jruby.RubyProc.call(RubyProc.java:290)
  org.jruby.RubyProc.call19(RubyProc.java:271)
  org.jruby.RubyProc$INVOKER$i$0$0$call19.call(RubyProc$INVOKER$i$0$0$call19.gen)
  org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:218)
  org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:214)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
  org.jruby.ast.CallSpecialArgNode.interpret(CallSpecialArgNode.java:69)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.ast.WhileNode.interpret(WhileNode.java:131)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
  org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
  org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:194)
  org.jruby.runtime.Interpreted19Block.call(Interpreted19Block.java:125)
  org.jruby.runtime.Block.call(Block.java:101)
  org.jruby.RubyProc.call(RubyProc.java:290)
  org.jruby.RubyProc.call(RubyProc.java:228)
  org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:96)
  java.lang.Thread.run(Thread.java:724)
@headius
Member
headius commented Sep 10, 2013

In my quick test I could not reproduce this on JRuby master with Java 6. I have a few more questions for you:

  • Show me jruby -v output.
  • What version of Java? Does it happen with a different version?
  • Development or production mode?
  • Try running with JRUBY_OPTS=-X-C to turn off JIT and see if it goes away.
  • Does this happen with JRuby 1.7.4?

I looked at the code referenced in the error and I can't see how it would be null. The Digest object gets initialized with a digest algorithm before ::new would return it, and nothing else sets it to null. The logic that loads the algorithm appears to always return either non-null or raise a different exception.

@BanzaiMan
Member

I have a suspicion that Java 7u40 and/or InvokeDynamic is to blame.

On master with 7u25, I was able to complete 483 requests.

It ran out of memory.

Java HotSpot(TM) 64-Bit Server VM warning: Exception java.lang.OutOfMemoryError occurred dispatching signal SIGINT to handler- the VM may need to be forcibly terminated
@BanzaiMan
Member

I can't test 7u40, since the package validation fails when I try installing 7u40.

@greghuc
greghuc commented Sep 11, 2013

To be able to replicate, I'd go with code at https://github.com/greghuc/rails-jruby-1.7.5-bug.git mentioned above.
It's got all the settings I've been using, and the .env file contains my RAILS_ENV, JAVA_OPTS and JRUBY_OPTS.

I had issues with ab on mac, which were fixed by: http://superuser.com/questions/323840/apache-bench-test-erroron-os-x-apr-socket-recv-connection-reset-by-peer-54

In answer to questions:

jruby -v
jruby 1.7.5.dev (1.9.3p392) 2013-09-10 9edc566 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_40-b40 +indy [darwin-x86_64]

Bug manifests for java 1.7.0_40 and 1.6.0_51 (the standard issue on my Mac)

java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b40)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b55, mixed mode)
java -version
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)

It's only happening in production mode, not development mode.

It happens with JRUBY_OPTS=-X-C applied, though the exception trace is slightly different. See below

It doesn't happen in JRuby 1.7.4

Exception from JRUBY_OPTS=-X-C mode:

Java::JavaLang::NullPointerException ():
  org.jruby.ext.openssl.Digest.getAlgorithm(Digest.java:229)
  org.jruby.ext.openssl.Digest.getShortAlgorithm(Digest.java:233)
  org.jruby.ext.openssl.HMAC.getDigestAlgorithmName(HMAC.java:182)
  org.jruby.ext.openssl.HMAC.s_hexdigest(HMAC.java:91)
  org.jruby.ext.openssl.HMAC$INVOKER$s$3$0$s_hexdigest.call(HMAC$INVOKER$s$3$0$s_hexdigest.gen)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:236)
  org.jruby.ast.CallThreeArgNode.interpret(CallThreeArgNode.java:61)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.DNode.appendToString(DNode.java:70)
  org.jruby.ast.DNode.buildDynamicString(DNode.java:88)
  org.jruby.ast.DNode.interpret(DNode.java:36)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.AttrAssignTwoArgNode.interpret(AttrAssignTwoArgNode.java:36)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:225)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
  org.jruby.ast.AttrAssignTwoArgNode.interpret(AttrAssignTwoArgNode.java:42)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:268)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:236)
  org.jruby.ast.FCallThreeArgNode.interpret(FCallThreeArgNode.java:40)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.ast.IfNode.interpret(IfNode.java:118)
  org.jruby.ast.IfNode.interpret(IfNode.java:118)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:126)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:70)
  org.jruby.ast.FCallManyArgsNode.interpret(FCallManyArgsNode.java:60)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.MultipleAsgn19Node.interpret(MultipleAsgn19Node.java:104)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.RescueNode.executeBody(RescueNode.java:221)
  org.jruby.ast.RescueNode.interpret(RescueNode.java:116)
  org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
  org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
  org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:157)
  org.jruby.runtime.Interpreted19Block.yieldSpecific(Interpreted19Block.java:130)
  org.jruby.runtime.Block.yieldSpecific(Block.java:111)
  org.jruby.ast.ZYieldNode.interpret(ZYieldNode.java:25)
  org.jruby.ast.OrNode.interpret(OrNode.java:100)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.AndNode.interpret(AndNode.java:97)
  org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:161)
  org.jruby.RubyClass.finvoke(RubyClass.java:527)
  org.jruby.RubyBasicObject.send19(RubyBasicObject.java:1504)
  org.jruby.RubyKernel.send19(RubyKernel.java:2238)
  org.jruby.RubyKernel$INVOKER$s$send19.call(RubyKernel$INVOKER$s$send19.gen)
  org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:336)
  org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:179)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:183)
  org.jruby.ast.FCallOneArgBlockPassNode.interpret(FCallOneArgBlockPassNode.java:32)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:204)
  org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:177)
  org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:188)
  org.jruby.ast.FCallOneArgBlockNode.interpret(FCallOneArgBlockNode.java:34)
  org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
  org.jruby.ast.MultipleAsgn19Node.interpret(MultipleAsgn19Node.java:104)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.ast.RescueNode.executeBody(RescueNode.java:221)
  org.jruby.ast.RescueNode.interpret(RescueNode.java:116)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.RescueNode.executeBody(RescueNode.java:221)
  org.jruby.ast.RescueNode.interpret(RescueNode.java:116)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.ast.RescueNode.executeBody(RescueNode.java:221)
  org.jruby.ast.RescueNode.interpret(RescueNode.java:116)
  org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:225)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
  org.jruby.ast.FCallTwoArgNode.interpret(FCallTwoArgNode.java:38)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
  org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
  org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:157)
  org.jruby.runtime.Interpreted19Block.yieldSpecific(Interpreted19Block.java:135)
  org.jruby.runtime.Block.yieldSpecific(Block.java:120)
  org.jruby.ast.YieldOneNode.interpret(YieldOneNode.java:35)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
  org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
  org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:157)
  org.jruby.runtime.Interpreted19Block.yieldSpecific(Interpreted19Block.java:135)
  org.jruby.runtime.Block.yieldSpecific(Block.java:120)
  org.jruby.ast.YieldOneNode.interpret(YieldOneNode.java:35)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:204)
  org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:177)
  org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:188)
  org.jruby.ast.CallSpecialArgBlockNode.interpret(CallSpecialArgBlockNode.java:64)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:204)
  org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:177)
  org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:188)
  org.jruby.ast.CallOneArgBlockNode.interpret(CallOneArgBlockNode.java:60)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.IfNode.interpret(IfNode.java:116)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:60)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.MultipleAsgn19Node.interpret(MultipleAsgn19Node.java:104)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:204)
  org.jruby.runtime.callsite.SuperCallSite.callBlock(SuperCallSite.java:190)
  org.jruby.runtime.callsite.SuperCallSite.call(SuperCallSite.java:197)
  org.jruby.runtime.callsite.SuperCallSite.callVarargs(SuperCallSite.java:108)
  org.jruby.ast.SuperNode.interpret(SuperNode.java:115)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.MultipleAsgn19Node.interpret(MultipleAsgn19Node.java:104)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
  org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
  org.jruby.ast.MultipleAsgn19Node.interpret(MultipleAsgn19Node.java:104)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.ast.RescueNode.executeBody(RescueNode.java:221)
  org.jruby.ast.RescueNode.interpret(RescueNode.java:116)
  org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
  org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:225)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
  org.jruby.ast.FCallTwoArgNode.interpret(FCallTwoArgNode.java:38)
  org.jruby.ast.CaseNode.interpret(CaseNode.java:121)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.WhileNode.interpret(WhileNode.java:131)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.ast.RescueNode.executeBody(RescueNode.java:221)
  org.jruby.ast.RescueNode.interpret(RescueNode.java:116)
  org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
  org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
  org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:225)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
  org.jruby.ast.FCallTwoArgNode.interpret(FCallTwoArgNode.java:38)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.IfNode.interpret(IfNode.java:116)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.RescueNode.interpret(RescueNode.java:159)
  org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
  org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
  org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:194)
  org.jruby.runtime.Interpreted19Block.call(Interpreted19Block.java:125)
  org.jruby.runtime.Block.call(Block.java:101)
  org.jruby.RubyProc.call(RubyProc.java:290)
  org.jruby.RubyProc.call19(RubyProc.java:271)
  org.jruby.RubyProc$INVOKER$i$0$0$call19.call(RubyProc$INVOKER$i$0$0$call19.gen)
  org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:218)
  org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:214)
  org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:202)
  org.jruby.ast.CallSpecialArgNode.interpret(CallSpecialArgNode.java:69)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.ast.WhileNode.interpret(WhileNode.java:131)
  org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
  org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
  org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
  org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
  org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:194)
  org.jruby.runtime.Interpreted19Block.call(Interpreted19Block.java:125)
  org.jruby.runtime.Block.call(Block.java:101)
  org.jruby.RubyProc.call(RubyProc.java:290)
  org.jruby.RubyProc.call(RubyProc.java:228)
  org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:96)
  java.lang.Thread.run(Thread.java:724)
@greghuc
greghuc commented Sep 11, 2013

So here's the minimum steps to reproduce this bug:

I just followed these steps and saw the exception above.

Here's my config:

jruby -v
jruby 1.7.5.dev (1.9.3p392) 2013-09-11 @jruby.revision@ on Java HotSpot(TM) 64-Bit Server VM 1.6.0_51-b11-457-11M4509 [darwin-x86_64]

java -version
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)

ab -V
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>

@greghuc
greghuc commented Sep 11, 2013

Exception does not manifest for ab -n 1000 -c 1 http://127.0.0.1:5000/
But does for ab -n 1000 -c 2 http://127.0.0.1:5000/

So concurrency related?

@enebo
Member
enebo commented Sep 11, 2013

Yeah, this has to be a concurrency bug. Also since it can happen with -X-C and also happen with Java 6 that eliminates both invokedynamic and the JIT as being the main issue. Either some poor assumption in Rails 4 (or dependent gem) reusing something per-thread across threads or something we are improperly doing internally. I am hoping it is us since we can fix the issue before release. Otherwise we will need to file an issue against an external project.

@enebo
Member
enebo commented Sep 11, 2013

I am still looking at this but it is just plain bizarre. I still believe this to be a concurrency issue (based on explanation above) but from looking at the code it is difficult to see how. This occasionally gets a Digest instance where the name of the digest SHA1 and the MessageDigest algo are both null. Figuring out how we get this instance with null values has been elusive. Everywhere I print out info about this instance in the call chain it is not null until the point it NPEs.

@headius headius added a commit that closed this issue Sep 12, 2013
@headius headius Always clone the block + frame for define_method. Fixes #1000.
When executing a method defined via define_method, the current
logic passes in a self to use. This self gets set into the binding
so that further down the stack the block invocation knows to use
the binding self as the actual self.

Work done for 1.7.5 to reduce frame costs increased the places
where we share a frame object and don't duplicate it across calls.
this caused define_method bodies to share a binding and frame for
every call, with multiple threads potentially stepping on each
other as they prepare and use that frame.

This commit makes the inner "call" method in RubyProc always
clone both the block and the frame if it intends to set the self
of the binding. This effectively isolates define_method body calls
from one another, avoiding the threading issue.

It has a side effect of breaking backref/lastline sharing across
define_method calls, which may or may not be a problem; MRI does
do this sharing, and it basically makes backref/lastline totally
unreliable and unusable within a define_method body. The current
logic makes it impossible to share backref/lastline and not share
self.

We should audit how self is being mutated on binding and frame
throughout the system and see if there's a way to stop doing that.
Removing the self mutation would be far better than having to
clone every time.
901b47a
@headius headius closed this in 901b47a Sep 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment