Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-7579

SimpleDateFormat is not thread safe

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 9.0.0.CR4
    • 9.0.0.CR2
    • Remote Protocols
    • None

    Description

      org.infinispan.rest.Server has a static field of DatePatternRfc1123LocaleUS, wihich is an instance of SimpleDateFormat, and is causing the following error during a load test.

      2017-03-03 15:57:55,939 ERROR [org.jboss.resteasy.plugins.server.netty.i18n] (nioEventLoopGroup-6-8) RESTEASY018525: Unexpected: org.jboss.resteasy.spi.UnhandledException: java.lang.ArrayIndexOutOfBoundsException: -2147483648
              at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
              at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
              at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
              at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
              at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
              at org.jboss.resteasy.plugins.server.netty.RequestDispatcher.service(RequestDispatcher.java:83)
              at org.jboss.resteasy.plugins.server.netty.RequestHandler.channelRead0(RequestHandler.java:54)
              at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
              at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
              at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:32)
              at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:283)
              at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358)
              at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:374)
              at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
              at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
              at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.ArrayIndexOutOfBoundsException: -2147483648
              at java.util.Calendar.getDisplayName(Calendar.java:2114)
              at java.text.SimpleDateFormat.subFormat(SimpleDateFormat.java:1125)
              at java.text.SimpleDateFormat.format(SimpleDateFormat.java:966)
              at java.text.SimpleDateFormat.format(SimpleDateFormat.java:936)
              at java.text.DateFormat.format(DateFormat.java:345)
              at org.infinispan.rest.Server.org$infinispan$rest$Server$$formatDate(Server.scala:222)
              at org.infinispan.rest.Server.org$infinispan$rest$Server$$getMimeEntry(Server.scala:140)
              at org.infinispan.rest.Server$$anonfun$getEntry$1$$anonfun$apply$10.apply(Server.scala:98)
              at org.infinispan.rest.Server$$anonfun$getEntry$1$$anonfun$apply$10.apply(Server.scala:96)
              at org.infinispan.rest.Server.org$infinispan$rest$Server$$ensureFreshEnoughEntry(Server.scala:111)
              at org.infinispan.rest.Server$$anonfun$getEntry$1.apply(Server.scala:95)
              at org.infinispan.rest.Server$$anonfun$getEntry$1.apply(Server.scala:89)
              at org.infinispan.rest.Server.protectCacheNotFound(Server.scala:498)
              at org.infinispan.rest.Server.getEntry(Server.scala:89)
              at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
              at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
              at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
              at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
              at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
              ... 12 more
      

      A similar issue is found here:
      https://github.com/rhuss/jolokia/issues/184

      Attachments

        Issue Links

          Activity

            People

              ttarrant@redhat.com Tristan Tarrant
              ttarrant@redhat.com Tristan Tarrant
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: