Project

General

Profile

Actions

Bug #5925

closed

Lazy initialization is not thread safe.

Added by xbaldauf (Xuân Baldauf) almost 13 years ago. Updated about 12 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
1.9.3p0
Backport:
[ruby-core:42222]

Description

Change http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/uri/common.rb?r1=26887&r2=26888& introduced lazy initialization of URI::TBLENCWWWCOMP_ . However, lazy initialization is not threadsafe. Specifically, http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/uri/common.rb?annotate=34214 line 873 contains the call

TBLENCWWWCOMP_.replace(tbl)

Under JRuby 1.6.4, this makes 2 threads which are simultaneously attempting to lazily initialize TBLENCWWWCOMP_ spin forever, under other VMs, the results may vary.

Furthermore, the table TBLENCWWWCOMP_ will have 1025 entries, which is not really worth to delay initialization for.

This bug makes Rack not threadsafe, which in turn makes Rails not threadsafe.

See following JVM strack trace for further details how this can happen.

""http-bio-3000"-exec-3" daemon prio=10 tid=0x00007ff3a0007000 nid=0x7b0 runnable [0x00000000452d2000]
java.lang.Thread.State: RUNNABLE
at org.jruby.RubyHash.internalGetEntry(RubyHash.java:507)
at org.jruby.RubyHash.op_asetForString(RubyHash.java:901)
at org.jruby.RubyHash.fastASetCheckString(RubyHash.java:862)
at org.jruby.RubyHash.op_aset(RubyHash.java:888)
at org.jruby.RubyHash$26.visit(RubyHash.java:1625)
at org.jruby.RubyHash.visitAll(RubyHash.java:594)
at org.jruby.RubyHash.replaceCommon(RubyHash.java:1651)
at org.jruby.RubyHash.replace(RubyHash.java:1623)
at org.jruby.RubyHash$i$1$0$replace.call(RubyHash$i$1$0$replace.gen:65535)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:167)
at home.user.$_dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.vendor.rack_minus_1_dot_3_dot_5.rack.backports.uri.common_18.chained_4_rescue_2$RUBY$SYNTHETICdecode_www_form_component(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/vendor/rack-1.3.5/rack/backports/uri/common_18.rb:62)
at home.user.$_dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.vendor.rack_minus_1_dot_3_dot_5.rack.backports.uri.common_18.method__3$RUBY$decode_www_form_component(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/vendor/rack-1.3.5/rack/backports/uri/common_18.rb:61)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$vendor$rack_minus_1_dot_3_dot_5$rack$backports$uri$common_18$method__3$RUBY$decode_www_form_component.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$vendor$rack_minus_1_dot_3_dot_5$rack$backports$uri$common_18$method__3$RUBY$decode_www_form_component:65535)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:211)
at org.jruby.internal.runtime.methods.CompiledMethod.call(CompiledMethod.java:260)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:167)
at home.user.$_dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.vendor.rack_minus_1_dot_3_dot_5.rack.utils.method__4$RUBY$unescape(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/vendor/rack-1.3.5/rack/utils.rb:37)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$vendor$rack_minus_1_dot_3_dot_5$rack$utils$method__4$RUBY$unescape.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$vendor$rack_minus_1_dot_3_dot_5$rack$utils$method__4$RUBY$unescape:65535)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$vendor$rack_minus_1_dot_3_dot_5$rack$utils$method__4$RUBY$unescape.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$vendor$rack_minus_1_dot_3_dot_5$rack$utils$method__4$RUBY$unescape:65535)
at org.jruby.internal.runtime.methods.WrapperMethod.call(WrapperMethod.java:58)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:167)
at home.user.$dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.rack.adapter.rails.method__4$RUBY$file_exist_p(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/rack/adapter/rails.rb:27)
at home$user$$dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__4$RUBY$file_exist_p.call(home$user$$dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__4$RUBY$file_exist_p:65535)
at home$user$$dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__4$RUBY$file_exist_p.call(home$user$$dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__4$RUBY$file_exist_p:65535)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:167)
at home.user.$_dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.rack.adapter.rails.method__7$RUBY$call(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/rack/adapter/rails.rb:46)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__7$RUBY$call.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__7$RUBY$call:65535)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__7$RUBY$call.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__7$RUBY$call:65535)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:312)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:169)
at home.user.$_dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.jruby.rack.rails.method__30$RUBY$call(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/jruby/rack/rails.rb:186)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$jruby$rack$rails$method__30$RUBY$call.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$jruby$rack$rails$method__30$RUBY$call:65535)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$jruby$rack$rails$method__30$RUBY$call.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$jruby$rack$rails$method__30$RUBY$call:65535)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:312)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:169)
at home.user.$_dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.rack.handler.servlet.method__4$RUBY$call(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/rack/handler/servlet.rb:19)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$handler$servlet$method__4$RUBY$call.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$handler$servlet$method__4$RUBY$call:65535)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$handler$servlet$method__4$RUBY$call.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$handler$servlet$method__4$RUBY$call:65535)
at org.jruby.RubyClass.finvoke(RubyClass.java:686)
at org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:548)
at org.jruby.RubyBasicObject.callMethod(RubyBasicObject.java:358)
at org.jruby.javasupport.JavaEmbedUtils$1.callMethod(JavaEmbedUtils.java:143)
at org.jruby.rack.DefaultRackApplication.__call(DefaultRackApplication.java:66)
at org.jruby.rack.DefaultRackApplication.call(DefaultRackApplication.java:40)
at org.jruby.rack.AbstractRackDispatcher.process(AbstractRackDispatcher.java:29)
at org.jruby.rack.AbstractServlet.service(AbstractServlet.java:35)
at org.jruby.rack.AbstractServlet.service(AbstractServlet.java:42)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
- locked <0x00007ff3d293d2e0> (a org.apache.tomcat.util.net.SocketWrapper)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

""http-bio-3000"-exec-2" daemon prio=10 tid=0x00007ff3ac9b2800 nid=0x7af waiting on condition [0x00000000450d3000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00007ff3d2ad16b0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1987)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:399)
at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:104)
at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:32)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:662)

""http-bio-3000"-exec-1" daemon prio=10 tid=0x00007ff3adba5800 nid=0x7ae runnable [0x0000000044ed0000]
java.lang.Thread.State: RUNNABLE
at org.jruby.RubyHash.internalGetEntry(RubyHash.java:507)
at org.jruby.RubyHash.op_asetForString(RubyHash.java:901)
at org.jruby.RubyHash.fastASetCheckString(RubyHash.java:862)
at org.jruby.RubyHash.op_aset(RubyHash.java:888)
at org.jruby.RubyHash$26.visit(RubyHash.java:1625)
at org.jruby.RubyHash.visitAll(RubyHash.java:594)
at org.jruby.RubyHash.replaceCommon(RubyHash.java:1651)
at org.jruby.RubyHash.replace(RubyHash.java:1623)
at org.jruby.RubyHash$i$1$0$replace.call(RubyHash$i$1$0$replace.gen:65535)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:312)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:169)
at home.user.$_dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.vendor.rack_minus_1_dot_3_dot_5.rack.backports.uri.common_18.chained_4_rescue_2$RUBY$SYNTHETICdecode_www_form_component(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/vendor/rack-1.3.5/rack/backports/uri/common_18.rb:62)
at home.user.$_dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.vendor.rack_minus_1_dot_3_dot_5.rack.backports.uri.common_18.method__3$RUBY$decode_www_form_component(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/vendor/rack-1.3.5/rack/backports/uri/common_18.rb:61)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$vendor$rack_minus_1_dot_3_dot_5$rack$backports$uri$common_18$method__3$RUBY$decode_www_form_component.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$vendor$rack_minus_1_dot_3_dot_5$rack$backports$uri$common_18$method__3$RUBY$decode_www_form_component:65535)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:211)
at org.jruby.internal.runtime.methods.CompiledMethod.call(CompiledMethod.java:260)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:167)
at home.user.$_dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.vendor.rack_minus_1_dot_3_dot_5.rack.utils.method__4$RUBY$unescape(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/vendor/rack-1.3.5/rack/utils.rb:37)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$vendor$rack_minus_1_dot_3_dot_5$rack$utils$method__4$RUBY$unescape.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$vendor$rack_minus_1_dot_3_dot_5$rack$utils$method__4$RUBY$unescape:65535)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$vendor$rack_minus_1_dot_3_dot_5$rack$utils$method__4$RUBY$unescape.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$vendor$rack_minus_1_dot_3_dot_5$rack$utils$method__4$RUBY$unescape:65535)
at org.jruby.internal.runtime.methods.WrapperMethod.call(WrapperMethod.java:58)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:167)
at home.user.$dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.rack.adapter.rails.method__4$RUBY$file_exist_p(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/rack/adapter/rails.rb:27)
at home$user$$dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__4$RUBY$file_exist_p.call(home$user$$dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__4$RUBY$file_exist_p:65535)
at home$user$$dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__4$RUBY$file_exist_p.call(home$user$$dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__4$RUBY$file_exist_p:65535)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:167)
at home.user.$_dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.rack.adapter.rails.method__7$RUBY$call(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/rack/adapter/rails.rb:46)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__7$RUBY$call.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__7$RUBY$call:65535)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__7$RUBY$call.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$adapter$rails$method__7$RUBY$call:65535)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:167)
at home.user.$_dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.jruby.rack.rails.method__30$RUBY$call(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/jruby/rack/rails.rb:186)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$jruby$rack$rails$method__30$RUBY$call.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$jruby$rack$rails$method__30$RUBY$call:65535)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$jruby$rack$rails$method__30$RUBY$call.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$jruby$rack$rails$method__30$RUBY$call:65535)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:167)
at home.user.$_dot_rvm.gems.jruby_minus_1_dot_6_dot_4.gems.jruby_minus_rack_minus_1_dot_1_dot_1.lib.jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar.rack.handler.servlet.method__4$RUBY$call(file:/home/user/.rvm/gems/jruby-1.6.4/gems/jruby-rack-1.1.1/lib/jruby-rack-1.1.1.jar!/rack/handler/servlet.rb:19)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$handler$servlet$method__4$RUBY$call.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$handler$servlet$method__4$RUBY$call:65535)
at home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$handler$servlet$method__4$RUBY$call.call(home$user$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_4$gems$jruby_minus_rack_minus_1_dot_1_dot_1$lib$jruby_minus_rack_minus_1_dot_1_dot_1_dot_jar$rack$handler$servlet$method__4$RUBY$call:65535)
at org.jruby.RubyClass.finvoke(RubyClass.java:686)
at org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:548)
at org.jruby.RubyBasicObject.callMethod(RubyBasicObject.java:358)
at org.jruby.javasupport.JavaEmbedUtils$1.callMethod(JavaEmbedUtils.java:143)
at org.jruby.rack.DefaultRackApplication.__call(DefaultRackApplication.java:66)
at org.jruby.rack.DefaultRackApplication.call(DefaultRackApplication.java:40)
at org.jruby.rack.AbstractRackDispatcher.process(AbstractRackDispatcher.java:29)
at org.jruby.rack.AbstractServlet.service(AbstractServlet.java:35)
at org.jruby.rack.AbstractServlet.service(AbstractServlet.java:42)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
- locked <0x00007ff3d28c3118> (a org.apache.tomcat.util.net.SocketWrapper)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)


Files

noname (500 Bytes) noname Anonymous, 01/24/2012 10:53 AM

Updated by nahi (Hiroshi Nakamura) almost 13 years ago

=begin
I think the author expected that Hash#replace is thread-safe, and it surely is in CRuby. (see rescue for double freeze)

TBLENCWWWCOMP_ = {} # :nodoc:
...
def self.encode_www_form_component(str)
if TBLENCWWWCOMP_.empty?
tbl = {}
256.times do |i|
tbl[i.chr] = '%%%02X' % i
end
tbl[' '] = '+'
begin
TBLENCWWWCOMP_.replace(tbl)
TBLENCWWWCOMP_.freeze
rescue
end
end
...

Someone can rewrite this with singleton.rb. Challenger?
=end

Updated by Anonymous almost 13 years ago

On Tue, Jan 24, 2012 at 10:06:21AM +0900, Hiroshi Nakamura wrote:

Issue #5925 has been updated by Hiroshi Nakamura.

=begin
I think the author expected that Hash#replace is thread-safe, and it surely is in CRuby. (see rescue for double freeze)

TBLENCWWWCOMP_ = {} # :nodoc:
...
def self.encode_www_form_component(str)
if TBLENCWWWCOMP_.empty?
tbl = {}
256.times do |i|
tbl[i.chr] = '%%%02X' % i
end
tbl[' '] = '+'
begin
TBLENCWWWCOMP_.replace(tbl)
TBLENCWWWCOMP_.freeze
rescue
end
end
...

Someone can rewrite this with singleton.rb. Challenger?

Why don't we just do it when the file is required? I know it adds
overhead when the file is required, but that seems minimal when compared
to the runtime savings.

I made a patch here:

https://gist.github.com/1667280

--
Aaron Patterson
http://tenderlovemaking.com/

Actions #3

Updated by naruse (Yui NARUSE) almost 13 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r34364.
Xuân, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/uri/common.rb (URI.encode_www_form_component): initialize on
    requiring to support JRuby, which runs parallel multithreads.
    [ruby-core:42222] [Bug #5925]

  • lib/uri/common.rb (URI.decode_www_form_component): initialize on

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0