Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1116

Resteasy 3.0.9, Netty 4: POST request fails with error "IllegalReferenceCountException: refCnt: 0"

XMLWordPrintable

      Trying to do a POST request against netty 4.0.23 I get an IllegalReferenceCountException: refCnt: 0, while if I run the same code against resteasy-netty4 3.0.8.Final, there are not issues.

      MyForm:
      ...
      @FormParam(FILE_NAME_PARAM)
      @PartType(MediaType.APPLICATION_OCTET_STREAM)
      public void setFileData(byte[] fileData)

      { this.fileData = fileData; }

      MyResource:
      ...

      @POST
      @Path(MY_PATH)
      @Consumes(MediaType.MULTIPART_FORM_DATA)
      public Response handleForm(@MultipartForm MyForm form)

      { ... }

      Exception:
      org.jboss.resteasy.spi.ReaderException: io.netty.util.IllegalReferenceCountException: refCnt: 0
      at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:183) ~[resteasy-jaxrs-3.0.9.Final.jar:na]
      at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:89) ~[resteasy-jaxrs-3.0.9.Final.jar:na]
      at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:112) ~[resteasy-jaxrs-3.0.9.Final.jar:na]
      at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:296) ~[resteasy-jaxrs-3.0.9.Final.jar:na]
      at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:250) ~[resteasy-jaxrs-3.0.9.Final.jar:na]
      at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:237) ~[resteasy-jaxrs-3.0.9.Final.jar:na]
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356) [resteasy-jaxrs-3.0.9.Final.jar:na]
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179) [resteasy-jaxrs-3.0.9.Final.jar:na]
      at org.jboss.resteasy.plugins.server.netty.RequestDispatcher.service(RequestDispatcher.java:83) [resteasy-netty4-3.0.9.Final.jar:na]
      at org.jboss.resteasy.plugins.server.netty.RequestHandler.channelRead0(RequestHandler.java:53) [resteasy-netty4-3.0.9.Final.jar:na]
      at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-all-4.0.23.Final.jar:4.0.23.Final]
      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [netty-all-4.0.23.Final.jar:4.0.23.Final]
      at io.netty.channel.AbstractChannelHandlerContext.access$700(AbstractChannelHandlerContext.java:32) [netty-all-4.0.23.Final.jar:4.0.23.Final]
      at io.netty.channel.AbstractChannelHandlerContext$8.run(AbstractChannelHandlerContext.java:324) [netty-all-4.0.23.Final.jar:4.0.23.Final]
      at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380) [netty-all-4.0.23.Final.jar:4.0.23.Final]
      at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [netty-all-4.0.23.Final.jar:4.0.23.Final]
      at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [netty-all-4.0.23.Final.jar:4.0.23.Final]
      at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [netty-all-4.0.23.Final.jar:4.0.23.Final]
      at java.lang.Thread.run(Thread.java:722) [na:1.7.0_21]
      Caused by: io.netty.util.IllegalReferenceCountException: refCnt: 0
      at io.netty.buffer.AbstractByteBuf.ensureAccessible(AbstractByteBuf.java:1187) ~[netty-all-4.0.23.Final.jar:4.0.23.Final]
      at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1170) ~[netty-all-4.0.23.Final.jar:4.0.23.Final]
      at io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:676) ~[netty-all-4.0.23.Final.jar:4.0.23.Final]
      at io.netty.buffer.CompositeByteBuf.readBytes(CompositeByteBuf.java:1461) ~[netty-all-4.0.23.Final.jar:4.0.23.Final]
      at io.netty.buffer.CompositeByteBuf.readBytes(CompositeByteBuf.java:40) ~[netty-all-4.0.23.Final.jar:4.0.23.Final]
      at io.netty.buffer.ByteBufInputStream.read(ByteBufInputStream.java:120) ~[netty-all-4.0.23.Final.jar:4.0.23.Final]
      at java.io.SequenceInputStream.read(SequenceInputStream.java:208) ~[na:1.7.0_21]
      at java.io.SequenceInputStream.read(SequenceInputStream.java:211) ~[na:1.7.0_21]
      at org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer(BufferedLineReaderInputStream.java:94) ~[apache-mime4j-0.6.jar:0.6]
      at org.apache.james.mime4j.io.MimeBoundaryInputStream.fillBuffer(MimeBoundaryInputStream.java:196) ~[apache-mime4j-0.6.jar:0.6]
      at org.apache.james.mime4j.io.MimeBoundaryInputStream.<init>(MimeBoundaryInputStream.java:75) ~[apache-mime4j-0.6.jar:0.6]
      at org.apache.james.mime4j.parser.MimeEntity.createMimeStream(MimeEntity.java:217) ~[apache-mime4j-0.6.jar:0.6]
      at org.apache.james.mime4j.parser.MimeEntity.advance(MimeEntity.java:152) ~[apache-mime4j-0.6.jar:0.6]
      at org.apache.james.mime4j.parser.MimeTokenStream.next(MimeTokenStream.java:356) ~[apache-mime4j-0.6.jar:0.6]
      at org.apache.james.mime4j.parser.MimeStreamParser.parse(MimeStreamParser.java:144) ~[apache-mime4j-0.6.jar:0.6]
      at org.jboss.resteasy.plugins.providers.multipart.MultipartInputImpl$BinaryMessage.<init>(MultipartInputImpl.java:153) ~[resteasy-multipart-provider-3.0.9.Final.jar:na]
      at org.jboss.resteasy.plugins.providers.multipart.MultipartInputImpl$BinaryMessage.<init>(MultipartInputImpl.java:146) ~[resteasy-multipart-provider-3.0.9.Final.jar:na]
      at org.jboss.resteasy.plugins.providers.multipart.MultipartInputImpl.parse(MultipartInputImpl.java:197) ~[resteasy-multipart-provider-3.0.9.Final.jar:na]
      at org.jboss.resteasy.plugins.providers.multipart.MultipartFormAnnotationReader.readFrom(MultipartFormAnnotationReader.java:55) ~[resteasy-multipart-provider-3.0.9.Final.jar:na]
      at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:59) ~[resteasy-jaxrs-3.0.9.Final.jar:na]
      at org.jboss.resteasy.core.interception.ServerReaderInterceptorContext.readFrom(ServerReaderInterceptorContext.java:62) ~[resteasy-jaxrs-3.0.9.Final.jar:na]
      at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:51) ~[resteasy-jaxrs-3.0.9.Final.jar:na]
      at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.aroundReadFrom(GZIPDecodingInterceptor.java:59) ~[resteasy-jaxrs-3.0.9.Final.jar:na]
      at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53) ~[resteasy-jaxrs-3.0.9.Final.jar:na]
      at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:150) ~[resteasy-jaxrs-3.0.9.Final.jar:na]
      ... 18 common frames omitted

      It has been filed in github by other user before:

      https://github.com/resteasy/Resteasy/issues/583

              patriot1burke@gmail.com Bill Burke (Inactive)
              aperedas_jira Álvaro Pereda (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: