nanamikon opened a new issue #3858:
URL: https://github.com/apache/apisix/issues/3858


   ### Issue description
   
   ### Environment
   
   * apisix version (2.3):
   * OS (ubuntu 16):
   * OpenResty / Nginx version (1.19.3):
   * etcd version, if have (3.14):
   * apisix-dashboard version, if have:
   
   ### Minimal test code / Steps to reproduce the issue
   
   1.use traffic-split , and set the upstream as follow
   curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uri": "/index.html",
       "plugins": {
           "traffic-split": {
               "rules": [
                   {
                       "match": [
                           {
                               "vars": [
                                   ["http_release","==","new_release"]
                               ]
                           }
                       ],
                       "weighted_upstreams": [
                           {
                               "upstream": {
                                   "type": "chash",
                                   "key": "remote_addr",
                                   "name": "upstream_A",
                                   "nodes": {
                                       "127.0.0.1:1981":1
                                       "127.0.0.2:1981":1
                                   }
                               }
                           }
                       ]
                   }
               ]
           }
       },
       "upstream": {
               "type": "roundrobin",
               "nodes": {
                   "127.0.0.1:1980": 1
               }
       }
   }'
   
   2.
   curl http://127.0.0.1:9080/index.html -H "release:new_release" -i
   ```
   <html>
   <head><title>500 Internal Server Error</title></head>
   <body>
   <center><h1>500 Internal Server Error</h1></center>
   <hr><center>openresty</center>
   </body>
   </html>
   ```
   
   
   ### What's the actual result? (including assertion message & call stack if 
applicable)
   
   Error can be found in error.log
   ```
   2021/03/18 15:36:04 [error] 72662#72662: *683 failed to run 
balancer_by_lua*: /chash.lua:36: invalid argument, expect string value
   stack traceback:
           [C]: in function 'error'
           /data/app/huya-nginx-proxy/apisix/core/ctx.lua:139: in function 
'__index'
           /data/app/huya-nginx-proxy/apisix/balancer/chash.lua:36: in function 
'fetch_chash_hash_key'
           /data/app/huya-nginx-proxy/apisix/balancer/chash.lua:81: in function 
'get'
           /data/app/huya-nginx-proxy/apisix/balancer.lua:172: in function 
'pick_server'
           /data/app/huya-nginx-proxy/apisix/balancer.lua:197: in function 
'load_balancer'
           /data/app/huya-nginx-proxy/apisix/init.lua:718: in function 
'http_balancer_phase'
   ```
   
   ### What's the expected result?
   No error


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