Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6
-
Fix Version/s: JRuby 1.7.0.pre1
-
Component/s: Core Classes/Modules
-
Labels:None
-
Number of attachments :
Description
Why there is a lock here, got me...
java.lang.Thread.State: BLOCKED (on object monitor)
at java.util.Hashtable.get(Hashtable.java:333)
- locked <0x00000005e0162170> (a java.util.Hashtable)
at java.text.NumberFormat.getInstance(NumberFormat.java:742)
at java.text.NumberFormat.getNumberInstance(NumberFormat.java:390)
at org.jruby.util.Sprintf.rubySprintfToBuffer(Sprintf.java:815)
at org.jruby.util.Sprintf.rubySprintfToBuffer(Sprintf.java:240)
at org.jruby.util.Sprintf.sprintf(Sprintf.java:214)
at org.jruby.RubyString.opFormatCommon(RubyString.java:1157)
at org.jruby.RubyString.op_format(RubyString.java:1136)
at org.jruby.RubyString$i$1$0$op_format.call(RubyString$i$1$0$op_format.gen:65535)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrN.call(JavaMethod.java:728)
at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:86)
at org.jruby.RubyClass.finvoke(RubyClass.java:576)
at org.jruby.RubyBasicObject.send(RubyBasicObject.java:2778)
at org.jruby.RubyKernel.send(RubyKernel.java:2084)
at org.jruby.RubyKernel$s$send.call(RubyKernel$s$send.gen:65535)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroOrOneOrTwoOrNBlock.call(JavaMethod.java:283)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:201)
at rubyjit.String#%E980BE3DE7F9B6C8EEDF9D9120045507924ECC51.file_(/home/tomcat/tomcat10/webapps/ROOT/WEB-INF/gems/gems/i18n-0.5.0/lib/i18n/core_ext/string/interpolate.rb:101)
Yeah, pretty silly. The table it's synchronizing against basically just caches the format strings for a given locale. Because that cache might be used across threads, it's a Hashtable...which is unconditionally synchronized.
I'm sure there's a potential OpenJDK patch here, but for now I'm going to look into how we can just avoid calling the default methods.