org.jruby.util.Sprintf.rubySprintfToBuffer causing thread locks

Something is wrong when string formatting creates a mutex… Is this
a case where the instance of java.text.NumberFormat needs to be
cached by jruby?

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)

Wow, that’s pretty bizarre.

We could toss them into a thread-local, and then they’d never be
contended…but seriously, what’s up Java?

Open an issue please.

  • Charlie

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs