tzssangglass commented on issue #189: URL: https://github.com/apache/apisix-java-plugin-runner/issues/189#issuecomment-1226756930
> 看了一下2.15版本的APISIX发现和代码也对上了,走了ext-plugin-post-resp.lua插件的重试逻辑 Retries don't happen every time, only if the java plugin runner has handled the exception, ref: https://github.com/apache/apisix/blob/master/apisix/plugins/ext-plugin/init.lua#L730-L742 ``` local ok, err = send(sock, constants.RPC_HTTP_RESP_CALL, builder:Output()) if not ok then return nil, "failed to send RPC_HTTP_RESP_CALL: " .. err end local ty, resp = receive(sock) if ty == nil then return nil, "failed to receive RPC_HTTP_RESP_CALL: " .. resp end if ty ~= constants.RPC_HTTP_RESP_CALL then return nil, "failed to receive RPC_HTTP_RESP_CALL: unexpected type " .. ty end ``` I have reproduced it again in [Debug mode](https://github.com/apache/apisix-java-plugin-runner/blob/main/docs/en/latest/how-it-works.md#debug) I still can't reproduce it. Here is my reproduction process: 1. upstream(an openresty server) ``` master_process on; worker_processes 2; error_log logs/error.log warn; pid logs/nginx.pid; worker_rlimit_nofile 20480; events { accept_mutex off; worker_connections 10620; } worker_shutdown_timeout 3; http { server { listen 1980; access_log off; location / { content_by_lua_block { ngx.status = 204 ngx.say("hello, world") } } } } ``` test ``` curl http://127.0.0.1:1980/get -i HTTP/1.1 204 No Content Server: openresty/1.21.4.1 Date: Thu, 25 Aug 2022 04:19:24 GMT Connection: keep-alive ``` 2. route ``` curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "uri":"/get", "plugins":{ "ext-plugin-post-resp":{ "conf":[ { "name":"TestResponseFilter", "value":"{\"rewrite_path\":\"token\",\"validate_url\":\"https://www.sso.foo.com/token/validate\",\"rejected_code\":\"403\"}" } ] } }, "upstream":{ "nodes":{ "127.0.0.1:1980":1 }, "type":"roundrobin" } }' ``` config.yaml ``` apisix: admin_key: - name: admin key: edd1c9f034335f136f87ad84b625c8f1 # using fixed API token has security risk, please update it when you deploy to production environment role: admin ext-plugin: path_for_test: "/tmp/runner.sock" ``` 4. java plugin runner: https://github.com/tzssangglass/java-plugin-runner-demo-1 5. test proxy by APISIX and connect to java plugin runner ``` curl http://127.0.0.1:9080/get -i HTTP/1.1 204 No Content Connection: keep-alive Date: Thu, 25 Aug 2022 04:15:20 GMT Date: Thu, 25 Aug 2022 04:15:20 GMT Server: APISIX/2.15.0 ``` the logs of java plugin runner ``` 2022-08-25 12:15:14.714 INFO 2521381 --- [ main] c.e.d.DemoApplication : No active profile set, falling back to 1 default profile: "default" 2022-08-25 12:15:15.229 INFO 2521381 --- [ main] c.e.d.DemoApplication : Started DemoApplication in 0.898 seconds (JVM running for 1.716) 2022-08-25 12:15:15.362 WARN 2521381 --- [ main] o.a.a.p.r.s.ApplicationRunner : java runner is listening on the socket file: /tmp/runner.sock 2022-08-25 12:15:20.278 WARN 2521381 --- [ntLoopGroup-2-2] c.e.d.TestResponseFilter : status : 204 ``` -- 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]
