Cheol-Soon-Choi opened a new issue, #255:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/255

   ### Issue description
   When the upstream response status is 400 or 500, the postfilter cannot check 
the status.
   
   my post filter is
   ```
       @Override
       public void postFilter(PostRequest request, PostResponse response, 
PluginFilterChain chain) {
           log.info("--------------------post filter 
start------------11111111");
           log.info(request.getUpstreamHeaders().toString());
           log.info(request.getUpstreamStatusCode().toString());
           log.info(request.getBody());
           chain.postFilter(request, response);
       }
   ```
   
   When the upstream responds with 200, the log is
   ```
   --------------------post filter start------------11111111
   {Keep-Alive=timeout=60, Transfer-Encoding=chunked, test=1234, 
Connection=keep-alive, Date=Fri, 14 Jul 2023 02:12:15 GMT, 
Content-Type=application/json}
   200
   
{"createdDate":null,"modifiedDate":null,"id":null,"name":"ccs","apiCode":"abcd"}
   ```
   
   but, 400 or 500
   ```
   --------------------post filter start------------11111111
   {}
   0
   
{"createdDate":null,"modifiedDate":null,"id":null,"name":"ccs","apiCode":"abcd"}
   ```
   
   and one more thing..
   In about half of all calls, postfilter throws 
java.lang.IndexOutOfBoundsException: null.
   error.log is
   ```
   2023/07/14 11:35:23 [warn] 6638#6638: *17534332 [lua] init.lua:953: 
2023-07-14 11:35:23.257  INFO 6652 --- [tLoopGroup-34-5] c.d.p.F.TestFilter     
                  : --------------------post filter start------------11111111
   , context: ngx.timer
   2023/07/14 11:35:23 [warn] 6638#6638: *17534332 [lua] init.lua:953: 
2023-07-14 11:35:23.257 ERROR 6652 --- [tLoopGroup-34-5] 
o.a.a.p.r.h.RpcCallHandler               : handle request error:
   
   java.lang.IndexOutOfBoundsException: null
           at java.nio.Buffer.checkIndex(Buffer.java:693) ~[?:?]
           at java.nio.DirectByteBuffer.getInt(DirectByteBuffer.java:758) ~[?:?]
           at com.google.flatbuffers.Table.__vector_len(Table.java:125) 
~[flatbuffers-java-2.0.0.jar!/:?]
           at io.github.api7.A6.HTTPRespCall.Req.headersLength(Req.java:22) 
~[A6-0.6.0-RELEASE.jar!/:?]
           at 
org.apache.apisix.plugin.runner.PostRequest.getUpstreamHeaders(PostRequest.java:81)
 ~[apisix-runner-plugin-sdk-0.4.0.jar!/:0.4.0]
           at com.platform.Filter.TestFilter.postFilter(TestFilter.java:127) 
~[classes!/:1.0.0]
           at 
org.apache.apisix.plugin.runner.filter.PluginFilterChain.postFilter(PluginFilterChain.java:64)
 ~[apisix-runner-plugin-sdk-0.4.0.jar!/:0.4.0]
           at 
org.apache.apisix.plugin.runner.handler.RpcCallHandler.doPostFilter(RpcCallHandler.java:211)
 ~[apisix-runner-core-0.4.0.jar!/:0.4.0]
           at 
org.apache.apisix.plugin.runner.handler.RpcCallHandler.handleExtraInfo(RpcCallHandler.java:243)
 ~[apisix-runner-core-0.4.0.jar!/:0.4.0]
           at 
org.apache.apisix.plugin.runner.handler.RpcCallHandler.channelRead0(RpcCallHandler.java:92)
 ~[apisix-runner-core-0.4.0.jar!/:0.4.0]
           at 
org.apache.apisix.plugin.runner.handler.RpcCallHandler.channelRead0(RpcCallHandler.java:54)
 ~[apisix-runner-core-0.4.0.jar!/:0.4.0]
           at 
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
org.apache.apisix.plugin.runner.handler.PrepareConfHandler.channelRead0(PrepareConfHandler.java:57)
 ~[apisix-runner-core-0.4.0.jar!/:0.4.0]
           at 
org.apache.apisix.plugin.runner.handler.PrepareConfHandler.channelRead0(PrepareConfHandler.java:45)
 ~[apisix-runner-core-0.4.0.jar!/:0.4.0]
           at 
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
org.apache.apisix.plugin.runner.handler.PayloadDecoder.channelRead0(PayloadDecoder.java:45)
 ~[apisix-runner-core-0.4.0.jar!/:0.4.0]
           at 
org.apache.apisix.plugin.runner.handler.PayloadDecoder.channelRead0(PayloadDecoder.java:38)
 ~[apisix-runner-core-0.4.0.jar!/:0.4.0]
           at 
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
 ~[nett, context: ngx.timer
   2023/07/14 11:35:23 [warn] 6638#6638: *17534332 [lua] init.lua:953: 
y-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327)
 ~[netty-codec-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299)
 ~[netty-codec-4.1., context: ngx.timer
   2023/07/14 11:35:23 [warn] 6638#6638: *17534332 [lua] init.lua:953: 
78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:280) 
~[netty-handler-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
 ~[netty-transport-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800)
 ~[netty-transport-classes-epoll-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.epoll.EpollDomainSocketChannel$EpollDomainUnsafe.epollInReady(EpollDomainSocketChannel.java:138)
 ~[netty-transport-classes-epoll-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:487) 
~[netty-transport-classes-epoll-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:385) 
~[netty-transport-classes-epoll-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
 ~[netty-common-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) 
~[netty-common-4.1.78.Final.jar!/:4.1.78.Final]
           at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 ~[netty-common-4.1.78.Final.jar!/:4.1.78.Final]
           at java.lang.Thread.run(Thread.java:829) ~[?:?]
   ```
   TestFilter.java:127 line is 
**'log.info(request.getUpstreamHeaders().toString())'**
   
   can u check this problems?
   thx in advance
   
   ### Environment
   apisix 3.2.0
   apisix-java-plugin-runner 0.4.0
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to