wfgydbu opened a new issue #3392:
URL: https://github.com/apache/apisix/issues/3392


   ### Issue description
   field "timeout" in upstream_schema can not be zero, or number.
   
   
https://github.com/apache/apisix/blob/bf16615583c7645d51473f66fd5a970c9740afc4/apisix/schema_def.lua#L314
   
   
   ### Environment
   
   * apisix version (cmd: `apisix version`):  2.2 
   * OS: (cmd: `uname -a`) centos 7.6
   * OpenResty / Nginx version: (cmd: `nginx -V` or `openresty -V`) 
openresty/1.17.8.2
   
   ### Minimal test code / Steps to reproduce the issue
   
   1. setup route: 
   ```
   curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uri": "/*",
       "upstream": {
           "type": "roundrobin",
           "timeout": {
               "connect": 0,
               "send": 0,
               "read": 0
           },
           "nodes": {
               "127.0.0.1:8000": 10
           }
       }
   }'
   ```
   OK.
   
   2. run `curl http://127.0.0.1:9080`, return 500
   3.error.log
   ```
   2021/01/22 09:52:16 [error] 3537781#3537781: *442240 failed to run 
balancer_by_lua*: /kvm-hyt/onest-balancer/apisix/balancer.lua:107: bad connect 
timeout
   stack traceback:
        [C]: in function 'error'
        /usr/local/openresty/lualib/ngx/balancer.lua:175: in function 
'set_timeouts'
        /kvm-hyt/onest-balancer/apisix/balancer.lua:107: in function 
'pick_server'
        /kvm-hyt/onest-balancer/apisix/balancer.lua:194: in function 
'load_balancer'
        /kvm-hyt/onest-balancer/apisix/init.lua:708: in function 
'http_balancer_phase'
        balancer_by_lua:2: in main chunk while connecting to upstream, client: 
127.0.0.1, server: , request: "GET / HTTP/1.1", host: "127.0.0.1:9080"
   ```
   
   ### What's the actual result? (including assertion message & call stack if 
applicable)
   Error in error.log, 
   
   ### What's the expected result?
   timeouts actually cannot be zero
   


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

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


Reply via email to