You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "beginnerWJC (via GitHub)" <gi...@apache.org> on 2023/04/13 05:26:40 UTC

[GitHub] [apisix-java-plugin-runner] beginnerWJC opened a new issue, #235: bug:在PluginFilter类中通过requiredRespBody()方法设置为true后,在插件中调用PostRequest.getUpstreamStatusCode()方法会偶现(概率很高)获取到不正确的响应码

beginnerWJC opened a new issue, #235:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/235

   ### Issue description
   在PluginFilter类中通过requiredRespBody()方法设置为true后,在插件中调用PostRequest.getUpstreamStatusCode()方法会偶现(概率很高)获取到不正确的响应码
   ### Environment
   
   - apisix-java-plugin-runner 0.4.0
   - apisix 3.2.0
   - apisix-dashboard 3.0.0
   
   ### Minimal test code / Steps to reproduce the issue
   
   1.通过apisix-dashboard创建路由使用ext-plugin-post-resp插件
   ![image](https://user-images.githubusercontent.com/37164104/231642198-9f688e24-ba24-43b1-a8a6-e5f1f8e3d981.png)
   2.写一个简单的java测试插件,并且设置requiredRespBody()和requiredBody()都为true
   ![image](https://user-images.githubusercontent.com/37164104/231661619-a9ef5439-ee8a-4cb2-ad44-e1abfddd937f.png)
   3.查看日志发现一会是正常的406,一会是57
   ![image](https://user-images.githubusercontent.com/37164104/231661776-b56f0d43-be69-460a-a9fd-4de8577bed95.png)
   
   ### What's the actual result? (including assertion message & call stack if applicable)
   
   ### What's the expected result?
   


-- 
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: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] beginnerWJC commented on issue #235: bug:在PluginFilter类中通过requiredRespBody()方法设置为true后,在插件中调用PostRequest.getUpstreamStatusCode()方法会偶现(概率很高)获取到不正确的响应码

Posted by "beginnerWJC (via GitHub)" <gi...@apache.org>.
beginnerWJC commented on issue #235:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/235#issuecomment-1733708432

   @frankqoqo8 好的,感谢,我找时间验证一下


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] frankqoqo8 commented on issue #235: bug:在PluginFilter类中通过requiredRespBody()方法设置为true后,在插件中调用PostRequest.getUpstreamStatusCode()方法会偶现(概率很高)获取到不正确的响应码

Posted by "frankqoqo8 (via GitHub)" <gi...@apache.org>.
frankqoqo8 commented on issue #235:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/235#issuecomment-1715330494

   修正一下PostRequest的构造函数就行可以了:
   public PostRequest(Req req) {
           this.req = req;
           this.status = req.status();
           headers = new HashMap<>();
           for (int i = 0; i < req.headersLength(); i++) {
               TextEntry header = req.headers(i);
               headers.put(header.name(), header.value());
           }
       }


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] beginnerWJC commented on issue #235: bug:在PluginFilter类中通过requiredRespBody()方法设置为true后,在插件中调用PostRequest.getUpstreamStatusCode()方法会偶现(概率很高)获取到不正确的响应码

Posted by "beginnerWJC (via GitHub)" <gi...@apache.org>.
beginnerWJC commented on issue #235:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/235#issuecomment-1506368530

   这个和下面这个问题应该是一类问题
   https://github.com/apache/apisix-java-plugin-runner/issues/234


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug:在PluginFilter类中通过requiredRespBody()方法设置为true后,在插件中调用PostRequest.getUpstreamStatusCode()方法会偶现(概率很高)获取到不正确的响应码 [apisix-java-plugin-runner]

Posted by "gaoxingliang (via GitHub)" <gi...@apache.org>.
gaoxingliang commented on issue #235:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/235#issuecomment-1822239861

   It worked !  a non-official workaround https://github.com/gaoxingliang/apisix-java-plugin-runner/commit/6d1ccd30ab44f6faf5825d7891433be9f97b2ee7


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org