Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-14098

netty throws exception if post does not have an empty body

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      I have a very simple route:

      class UiaRouteConfig extends RouteBuilder {
          @Override
          public void configure() {
              from("netty-http:http://0.0.0.0:8080/authorization")
                      .to("mock:foo");
          }
      }
      

      If I send a post with no data like this, it works as expected:

      curl -v -X POST http://localhost:8080/authorization
      

      However, if I send even one byte of data like this

      curl -v -X POST http://localhost:8080/authorization -d x
      

      netty throws this exception:

      13:10:14.370 [Camel (camel-1) thread #5 - NettyEventExecutorGroup] DEBUG o.a.c.c.netty.http.NettyHttpConsumer - Closing channel as an exception was thrown from Netty13:10:14.370 [Camel (camel-1) thread #5 - NettyEventExecutorGroup] DEBUG o.a.c.c.netty.http.NettyHttpConsumer - Closing channel as an exception was thrown from Nettyio.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1 at io.netty.util.internal.ReferenceCountUpdater.toLiveRealRefCnt(ReferenceCountUpdater.java:74) at io.netty.util.internal.ReferenceCountUpdater.release(ReferenceCountUpdater.java:138) at io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:100) at io.netty.handler.codec.http.HttpObjectAggregator$AggregatedFullHttpMessage.release(HttpObjectAggregator.java:379) at io.netty.util.ReferenceCountUtil.release(ReferenceCountUtil.java:88) at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:112) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:56) at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:365) at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66) at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at java.base/java.lang.Thread.run(Thread.java:834)

      If it helps, I have uploaded the two classes in this example, along with a maven pom file to build an executable .jar.

      Attachments

        1. UiaMain.java
          0.4 kB
          Mark Grand
        2. UiaRouteConfig.java
          0.3 kB
          Mark Grand
        3. pom.xml
          4 kB
          Mark Grand

        Activity

          People

            zhfeng Zheng Feng
            mgrand Mark Grand
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h
                1h