You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/01/17 11:03:42 UTC

[GitHub] [apisix] shelltea opened a new issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

shelltea opened a new issue #6132:
URL: https://github.com/apache/apisix/issues/6132


   ### Issue description
   
   When i use batch-request plugin,And send a request like this:
   ```
   ## 测试batch-requests
   ## 测试batch-requests
   curl -X "POST" "http://api.com/apisix/batch-requests" \
        -H 'Content-Type: application/json; charset=utf-8' \
        -d $'{
     "timeout": 200,
     "pipeline": [
       {
         "path": "/v2/comments/detail",
         "method": "GET",
         "query": {
           "commentId": "3231329",
           "userId": "108580553",
           "pageNo": "1"
         }
       },
       {
         "path": "/v2/comments/list",
         "method": "GET",
         "query": {
           "pageNo": "1",
           "userId": "108580553",
           "businessId": "101155"
         }
       }
     ]
   }'
   ```
   
   I got this:
   ```
   [
     {
       "body": "{\"code\":0,\"message\":\"\",\"data\":{\"totalCount\":0,\"pageNo\":1,\"pageList\":[{\"user\":{\"headUrl\":\"https:\/\/cdn.abc.com\/kstory\/headimgs\/123.png\",\"headType\":null,\"ornamentUrl\":null,\"nickname\":\"乙\",\"nicknameColor\":\"#1B1B1B\",\"listenIcon\":\"\",\"birthdayIcon\":\"\",\"userIdentityIconList\":[],\"router\":null},\"comment\":{\"commentId\":3231329,\"commentTime\":\"2018-03-27\",\"commentType\":1,\"commentText\":\"可能是另一只猴子跟乔治做了,好朋友。\",\"audioUrl\":null,\"audioDuration\":null,\"isPraise\":false,\"praiseCount\":50,\"praiseCountText\":\"50\",\"backgroundStyle\":null,\"childrenCommentCount\":0,\"children\":[]}}],\"hasNext\":false}}",
       "headers": {
         "Connection": "close",
         "Date": "Mon, 17 Jan 2022 10:51:15 GMT",
         "Content-Type": "application\/json",
         "Access-Control-Expose-Headers": "*",
         "Access-Control-Max-Age": "7200",
         "Access-Control-Allow-Methods": "*",
         "Access-Control-Allow-Origin": "*",
         "Transfer-Encoding": "chunked",
         "X-Request-Id": "858335b8-767b-4ca8-85fd-e98c6239b344",
         "Server": "APISIX\/2.10.2",
         "Cache-Control": "private, max-age=0"
       },
       "status": 200,
       "reason": ""
     },
     {
       "reason": "upstream timeout",
       "status": 504
     },
     {}
   ]
   ```
   The first path `/v2/comments/detail` return 200,The second path `/v2/comments/list` return 504.
   But when send a request included only second path,return 200 like this:
   ```
   ## 测试batch-requests
   curl -X "POST" "http://api.com/apisix/batch-requests" \
        -H 'Content-Type: application/json; charset=utf-8' \
        -d $'{
     "timeout": 200,
     "pipeline": [
       {
         "path": "/v2/comments/list",
         "method": "GET",
         "query": {
           "pageNo": "1",
           "userId": "108580553",
           "businessId": "101155"
         }
       }
     ]
   }'
   
   ```
   
   Response:
   ```
   [
     {
       "body": "{\"code\":0,\"message\":\"\",\"data\":{\"totalCount\":0,\"pageNo\":1,\"hasNext\":false}}",
       "headers": {
         "Connection": "close",
         "Date": "Mon, 17 Jan 2022 11:00:27 GMT",
         "Content-Type": "application\/json",
         "Access-Control-Expose-Headers": "*",
         "X-Request-Id": "b3e4ff73-337e-4206-9abd-3eb06d1ebc33",
         "Transfer-Encoding": "chunked",
         "Access-Control-Allow-Origin": "*",
         "Server": "APISIX\/2.10.2",
         "Access-Control-Allow-Methods": "*",
         "Cache-Control": "private, max-age=0",
         "Access-Control-Max-Age": "7200"
       },
       "status": 200,
       "reason": ""
     }
   ]
   ```
   
   ### Environment
   
   - apisix version (cmd: `apisix version`):
   - OS (cmd: `uname -a`):
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   - etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   - apisix-dashboard version, if have:
   - the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
   - luarocks version, if the issue is about installation (cmd: `luarocks --version`):
   
   
   ### Steps to reproduce
   
   1. enable batch-request plugin
   2. send request with 2 path
   
   ### Actual result
   
   no
   
   ### Error log
   
   2022/01/17 19:02:57 [error] 47#47: *88331988 [lua] http.lua:885: __index(): closed, client: 11.20.19.20, server: _, request: "POST /apisix/batch-requests HTTP/1.1", host: "api.com"
   
   ### Expected result
   
   _No response_


-- 
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] tzssangglass commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015449343


   Does your upstream support [HTTP pipelining](https://en.wikipedia.org/wiki/HTTP_pipelining)


-- 
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] tzssangglass edited a comment on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
tzssangglass edited a comment on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015449343


   Does your upstream support [HTTP pipelining](https://en.wikipedia.org/wiki/HTTP_pipelining)?


-- 
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] tzssangglass commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015223322


   > I add more logs,And the second path's response status is nil.
   
   yes, so this is why the return 504.
   
   > connection = "close",
   
   > 2022/01/17 19:02:57 [error] 47#47: *88331988 [lua] http.lua:885: __index(): closed, client: 11.20.19.20, server: _, request: "POST /apisix/batch-requests HTTP/1.1", host: "api.com"
   
   This looks like the connection was closed upstream.


-- 
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] tzssangglass commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015224746


   You can use another public upstream to verify if it is your upstream that is the problem.


-- 
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] shelltea commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
shelltea commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1016049965


   @tzssangglass Hi,I think I found the cause of the problem.My HTTP client does not support `Keep-Alive` connections.
   ![image](https://user-images.githubusercontent.com/864375/150059478-173406c9-09d0-4172-a659-d3d4e6041b28.png)
   
   When i change to another client,the request was correct.Thanks for you help.
   


-- 
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] shelltea commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
shelltea commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015247999


   @tzssangglass I verify upstream's status,It's ok, When I sent request only included one path(`/v2/comments/list` or `/v2/comments/detail`),the response status is 200,Even I sent request with two identical paths,the second path return 504 upstream timeout.
   


-- 
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] shelltea commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
shelltea commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015214735


   Does anyone have time to look at this problem? @tzssangglass @leslie-tsang 


-- 
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] tzssangglass commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015268510


   > "timeout": 200,
   
   can you change this to `"timeout": 30000` and try again?


-- 
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] shelltea commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
shelltea commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015023025


   Hi @tzssangglass ,I add a log just like you code,But i didn't see any logs when i sent a request.Do i need to restart APISIX?
   ![image](https://user-images.githubusercontent.com/864375/149862012-766ef26f-9808-4ebb-ab3f-9fd9ff807c1c.png)
   


-- 
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] shelltea commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
shelltea commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015264293


   I changed to another upstream and path,same problem.
   
   ![image](https://user-images.githubusercontent.com/864375/149917357-d3629973-445b-48f7-996c-9e70b034ffe8.png)
   
   If i use same path ,same problem.
   
   ![image](https://user-images.githubusercontent.com/864375/149917663-e3d35f97-05c4-4c9e-9656-dec81ee30811.png)
   


-- 
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] tzssangglass commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1014586061


   can you add a log here: https://github.com/apache/apisix/blob/d9be046028db5850a752f3b872fe21a6bc376e66/apisix/plugins/batch-requests.lua#L262-L263
   
   just like:
   
   ```lua
       local aggregated_resp = {}
       ngx.log(ngx.WARN, "responses : ", require("inspect")(responses))
       for _, resp in ipairs(responses) do
   ```
   
   and show the `responses` in `logs/error.log`


-- 
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] shelltea commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
shelltea commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015119538


   @tzssangglass @leslie-tsang    I restart APISIX and here is the logs:
   ```
   2022/01/18 14:47:27 [error] 49#49: *246042 [lua] batch-requests.lua:263: handler(): responses : { {
       params = {
         headers = {
           ["X-Real-IP"] = "11.20.19.20",
           connection = "close",
           host = "api.com",
           ["user-agent"] = "Paw/3.1.10 (Macintosh; OS X/10.13.4) GCDHTTPRequest",
           <metatable> = {
             __index = <function 1>,
             __newindex = <function 2>,
             normalised = {
               connection = "connection",
               host = "host",
               ["proxy-authorization"] = "Proxy-Authorization",
               ["user-agent"] = "user-agent",
               ["x-real-ip"] = "X-Real-IP"
             }
           }
         },
         method = "GET",
         path = "/v2/comments/detail",
         query = {
           commentId = "3231329",
           pageNo = "1",
           userId = "108580553"
         },
         ssl_verify = false,
         version = 1.1,
         <metatable> = {
           __index = <1>{
             method = "GET",
             path = "/",
             version = 1.1
           }
         }
       },
       response_read = false,
       <metatable> = {
         __index = <function 3>
       }
     }, {
       params = {
         headers = {
           ["X-Real-IP"] = "11.20.19.20",
           connection = "close",
           host = "api.com",
           ["user-agent"] = "Paw/3.1.10 (Macintosh; OS X/10.13.4) GCDHTTPRequest",
           <metatable> = {
             __index = <function 4>,
             __newindex = <function 5>,
             normalised = {
               connection = "connection",
               host = "host",
               ["proxy-authorization"] = "Proxy-Authorization",
               ["user-agent"] = "user-agent",
               ["x-real-ip"] = "X-Real-IP"
             }
           }
         },
         method = "GET",
         path = "/v2/comments/list",
         query = {
           businessId = "101155",
           pageNo = "1",
           userId = "108580553"
         },
         ssl_verify = false,
         version = 1.1,
         <metatable> = {
           __index = <table 1>
         }
       },
       response_read = false,
       <metatable> = {
         __index = <function 6>
       }
     } }, client: 11.20.19.20, server: _, request: "POST /apisix/batch-requests HTTP/1.1", host: "api.com"
   ```
   
   Thanks for help.


-- 
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] tzssangglass closed issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
tzssangglass closed issue #6132:
URL: https://github.com/apache/apisix/issues/6132


   


-- 
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] shelltea commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
shelltea commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015217989


   I add more logs,And the second path's response status is nil.
   ![image](https://user-images.githubusercontent.com/864375/149907913-01dc5d14-6c07-40e3-8e56-b9b545d33440.png)
   
   
   ```
   2022/01/18 17:09:04 [error] 49#49: *23622 [lua] batch-requests.lua:268: handler(): responses loop: 200, client: 111.207.194.209, server: _, request: "POST /apisix/batch-requests HTTP/1.1", host: "api.com"
   2022/01/18 17:09:04 [error] 49#49: *23622 [lua] http.lua:885: __index(): closed, client: 11.20.19.20, server: _, request: "POST /apisix/batch-requests HTTP/1.1", host: "api.com"
   2022/01/18 17:09:04 [error] 49#49: *23622 [lua] batch-requests.lua:268: handler(): responses loop: nil, client: 111.207.194.209, server: _, request: "POST /apisix/batch-requests HTTP/1.1", host: "api.com"
   ```


-- 
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] shelltea commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
shelltea commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015276953


   I tried,Nothing has changed.


-- 
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] leslie-tsang commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
leslie-tsang commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015077429


   > Hi @tzssangglass ,I add a log just like you code,But i didn't see any logs when i sent a request.Do i need to restart APISIX? ![image](https://user-images.githubusercontent.com/864375/149862012-766ef26f-9808-4ebb-ab3f-9fd9ff807c1c.png)
   
   Hello there, you need to restart APISIX to apply the change.


-- 
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] shelltea commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
shelltea commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1016009792


   Our upstream are Spring Boot Application,Using Tomcat as Web Server fully implement HTTP/1.1.


-- 
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] tzssangglass commented on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1016109933


   ok, let close this.


-- 
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] tzssangglass edited a comment on issue #6132: bug: batch-requests get "504 upstream timeout" but upstream is correct.

Posted by GitBox <gi...@apache.org>.
tzssangglass edited a comment on issue #6132:
URL: https://github.com/apache/apisix/issues/6132#issuecomment-1015449343


   ~~Does your upstream support [HTTP pipelining](https://en.wikipedia.org/wiki/HTTP_pipelining)?~~


-- 
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