zhendongcmss commented on issue #10757:
URL: https://github.com/apache/apisix/issues/10757#issuecomment-1888785516

   I try `ngx.var.limit_rate = "300K"` but doesn't work.
   
![image](https://github.com/apache/apisix/assets/88528414/5dd79057-4559-432c-921a-7f3d24e86932)
   
   routes 
   ```
    curl http://127.0.0.1:9080/apisix/admin/routes/ -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -s | jq -S .
   {
     "action": "get",
     "count": 1,
     "node": {
       "dir": true,
       "key": "/apisix/routes",
       "nodes": [
         {
           "createdIndex": 492835,
           "key": "/apisix/routes/1",
           "modifiedIndex": 517595,
           "value": {
             "create_time": 1703600830,
             "id": "1",
             "plugins": {
               "example-plugin": {
                 "i": 10
               }
             },
             "priority": 0,
             "status": 1,
             "update_time": 1705053359,
             "upstream": {
               "hash_on": "vars",
               "nodes": {
                 "172.17.0.1:6677": 1
               },
               "pass_host": "pass",
               "scheme": "http",
               "type": "roundrobin"
             },
             "uri": "/*"
           }
         }
       ]
     }
   }
   
   ```
   
   
   info level logs
   ```
   2024/01/12 17:58:09 [info] 3683#3683: *24 [lua] config_etcd.lua:142: 
waitdir(): cancel watch connection success, context: ngx.timer
   2024/01/12 17:58:09 [info] 3683#3683: *24 [lua] config_etcd.lua:328: 
sync_data(): waitdir key: /apisix/services prev_index: 517587, context: 
ngx.timer
   2024/01/12 17:58:09 [info] 3683#3683: *24 [lua] config_etcd.lua:329: 
sync_data(): res: null, context: ngx.timer
   2024/01/12 17:58:09 [info] 3683#3683: *14 [lua] config_etcd.lua:142: 
waitdir(): cancel watch connection success, context: ngx.timer
   2024/01/12 17:58:09 [info] 3683#3683: *14 [lua] config_etcd.lua:328: 
sync_data(): waitdir key: /apisix/proto prev_index: 517587, context: ngx.timer
   2024/01/12 17:58:09 [info] 3683#3683: *14 [lua] config_etcd.lua:329: 
sync_data(): res: null, context: ngx.timer
   2024/01/12 17:58:09 [info] 3688#3688: *188 [lua] config_etcd.lua:142: 
waitdir(): cancel watch connection success, context: ngx.timer
   2024/01/12 17:58:09 [info] 3688#3688: *188 [lua] config_etcd.lua:328: 
sync_data(): waitdir key: /apisix/consumers prev_index: 517587, context: 
ngx.timer
   2024/01/12 17:58:09 [info] 3688#3688: *188 [lua] config_etcd.lua:329: 
sync_data(): res: null, context: ngx.timer
   2024/01/12 17:58:09 [info] 3683#3683: *22 [lua] v3.lua:649: request_chunk(): 
http request method: POST path: /watch body: 
{"create_request":{"start_revision":517598,"key":"L2FwaXNpeC9nbG9iYWxfcnVsZXM=","range_end":"L2FwaXNpeC9nbG9iYWxfcnVsZXQ="}}
 query: nil, context: ngx.timer
   2024/01/12 17:58:09 [info] 3684#3684: *131 [lua] v3.lua:649: 
request_chunk(): http request method: POST path: /watch body: 
{"create_request":{"start_revision":517587,"key":"L2FwaXNpeC9wcm90bw==","range_end":"L2FwaXNpeC9wcm90cA=="}}
 query: nil, context: ngx.timer
   2024/01/12 17:58:09 [info] 3686#3686: *57 [lua] v3.lua:649: request_chunk(): 
http request method: POST path: /watch body: 
{"create_request":{"start_revision":517587,"key":"L2FwaXNpeC9wbHVnaW5fY29uZmlncw==","range_end":"L2FwaXNpeC9wbHVnaW5fY29uZmlndA=="}}
 query: nil, context: ngx.timer
   2024/01/12 17:58:09 [info] 3682#3682: *103 [lua] config_etcd.lua:142: 
waitdir(): cancel watch connection success, context: ngx.timer
   2024/01/12 17:58:09 [info] 3682#3682: *103 [lua] config_etcd.lua:328: 
sync_data(): waitdir key: /apisix/plugin_configs prev_index: 517587, context: 
ngx.timer
   2024/01/12 17:58:09 [info] 3682#3682: *103 [lua] config_etcd.lua:329: 
sync_data(): res: null, context: ngx.timer
   2024/01/12 17:58:09 [info] 3686#3686: *50 [lua] v3.lua:649: request_chunk(): 
http request method: POST path: /watch body: 
{"create_request":{"start_revision":517598,"key":"L2FwaXNpeC9nbG9iYWxfcnVsZXM=","range_end":"L2FwaXNpeC9nbG9iYWxfcnVsZXQ="}}
 query: nil, context: ngx.timer
   2024/01/12 17:58:09 [info] 3689#3689: *164 [lua] v3.lua:649: 
request_chunk(): http request method: POST path: /watch body: 
{"create_request":{"start_revision":517587,"key":"L2FwaXNpeC9zZXJ2aWNlcw==","range_end":"L2FwaXNpeC9zZXJ2aWNldA=="}}
 query: nil, context: ngx.timer
   2024/01/12 17:58:09 [info] 3684#3684: *78241 [lua] route.lua:72: 
create_radixtree_uri_router(): insert uri route: 
{"priority":0,"create_time":1703600830,"status":1,"uri":"\/*","update_time":1705053359,"id":"1","plugins":{"example-plugin":{"i":10}},"upstream":{"nodes":[{"port":6677,"weight":1,"host":"172.17.0.1"}],"hash_on":"vars","scheme":"http","type":"roundrobin","pass_host":"pass","parent":{"orig_modifiedIndex":517595,"modifiedIndex":517595,"value":{"priority":0,"create_time":1703600830,"status":1,"uri":"\/*","update_time":1705053359,"id":"1","plugins":"table:
 0x7f8403467020","upstream":"table: 
0x7f8403467120"},"key":"\/apisix\/routes\/1","createdIndex":492835,"clean_handlers":{},"update_count":0,"has_domain":false}}},
 client: 192.168.8.110, server: _, request: "GET /50M HTTP/1.1", host: 
"192.168.8.110:9080"
   2024/01/12 17:58:09 [info] 3684#3684: *78241 [lua] route.lua:94: 
create_radixtree_uri_router(): route items: 
[{"priority":0,"paths":"\/*","handler":"function: 0x7f84033e1200"}], client: 
192.168.8.110, server: _, request: "GET /50M HTTP/1.1", host: 
"192.168.8.110:9080"
   2024/01/12 17:58:09 [info] 3684#3684: *78241 [lua] radixtree.lua:346: 
pre_insert_route(): path: / operator: <=, client: 192.168.8.110, server: _, 
request: "GET /50M HTTP/1.1", host: "192.168.8.110:9080"
   2024/01/12 17:58:09 [info] 3684#3684: *78241 [lua] radixtree.lua:234: 
insert_route(): insert route path: / dataprt: 1, client: 192.168.8.110, server: 
_, request: "GET /50M HTTP/1.1", host: "192.168.8.110:9080"
   2024/01/12 17:58:09 [info] 3684#3684: *78241 [lua] radixtree.lua:488: 
compare_param(): pcre pat: \/((.|\n)*), client: 192.168.8.110, server: _, 
request: "GET /50M HTTP/1.1", host: "192.168.8.110:9080"
   2024/01/12 17:58:09 [info] 3684#3684: *78241 [lua] init.lua:399: 
http_access_phase(): matched route: 
{"orig_modifiedIndex":517595,"modifiedIndex":517595,"value":{"priority":0,"create_time":1703600830,"status":1,"uri":"\/*","update_time":1705053359,"id":"1","plugins":{"example-plugin":{"i":10}},"upstream":{"nodes":[{"port":6677,"weight":1,"host":"172.17.0.1"}],"hash_on":"vars","scheme":"http","type":"roundrobin","pass_host":"pass","parent":{"orig_modifiedIndex":517595,"modifiedIndex":517595,"value":"table:
 
0x7f84034606f0","key":"\/apisix\/routes\/1","createdIndex":492835,"clean_handlers":"table:
 
0x7f8403468d10","update_count":0,"has_domain":false}}},"key":"\/apisix\/routes\/1","createdIndex":492835,"clean_handlers":{},"update_count":0,"has_domain":false},
 client: 192.168.8.110, server: _, request: "GET /50M HTTP/1.1", host: 
"192.168.8.110:9080"
   2024/01/12 17:58:09 [error] 3684#3684: *78241 [lua] example-plugin.lua:79: 
phase_func(): 22222, client: 192.168.8.110, server: _, request: "GET /50M 
HTTP/1.1", host: "192.168.8.110:9080"
   2024/01/12 17:58:09 [error] 3684#3684: *78241 [lua] example-plugin.lua:90: 
phase_func(): 111111, client: 192.168.8.110, server: _, request: "GET /50M 
HTTP/1.1", host: "192.168.8.110:9080"
   2024/01/12 17:58:09 [warn] 3684#3684: *78241 [lua] example-plugin.lua:91: 
phase_func(): plugin access phase, conf: {"i":10}, client: 192.168.8.110, 
server: _, request: "GET /50M HTTP/1.1", host: "192.168.8.110:9080"
   2024/01/12 17:58:09 [info] 3684#3684: *78241 [lua] balancer.lua:188: 
pick_server(): route: 
{"orig_modifiedIndex":517595,"modifiedIndex":517595,"value":{"priority":0,"create_time":1703600830,"status":1,"uri":"\/*","update_time":1705053359,"id":"1","plugins":{"example-plugin":{"i":10}},"upstream":{"nodes":[{"priority":0,"port":6677,"host":"172.17.0.1","weight":1}],"hash_on":"vars","scheme":"http","pass_host":"pass","parent":{"orig_modifiedIndex":517595,"modifiedIndex":517595,"value":"table:
 
0x7f84034606f0","key":"\/apisix\/routes\/1","createdIndex":492835,"clean_handlers":"table:
 
0x7f8403468d10","update_count":0,"has_domain":false},"type":"roundrobin","nodes_ref":"table:
 
0x7f84033e4eb0","original_nodes":[{"port":6677,"weight":1,"host":"172.17.0.1"}]}},"key":"\/apisix\/routes\/1","createdIndex":492835,"clean_handlers":{},"update_count":0,"has_domain":false},
 client: 192.168.8.110, server: _, request: "GET /50M HTTP/1.1", host: 
"192.168.8.110:9080"
   2024/01/12 17:58:09 [info] 3684#3684: *78241 [lua] balancer.lua:189: 
pick_server(): ctx: 
{"upstream_scheme":"http","conf_version":517595,"matched_upstream":"table: 
0x7f8403467120","global_rules":{"conf_version":2,"checker":"function: 
0x7f840a45c2f8","values":[false],"item_schema":{"required":["plugins"],"type":"object","properties":{"create_time":"table:
 
0x7f840a75a840","id":{"anyOf":[{"maxLength":64,"type":"string","pattern":"^[a-zA-Z0-9-_.]+$","minLength":1},{"minimum":1,"type":"integer"}]},"plugins":{"type":"object"},"update_time":{"type":"integer"}}},"etcd_cli":{"is_auth":false,"init_count":0,"is_cluster":false,"endpoints":[{"full_prefix":"http:\/\/127.0.0.1:2379\/v3","host":"127.0.0.1","http_host":"http:\/\/127.0.0.1:2379","scheme":"http","api_prefix":"\/v3","port":"2379"}],"ttl":-1,"timeout":30,"sema":{"sem":"cdata<struct
 ngx_http_lua_sema_s *>: 
0x7f8409a4a028"},"last_auth_time":1705052948.832,"serializer":{"deserialize":"function:
 0x7f840a753b28","serialize":"function: 0x7f
 
840a753b68"},"key_prefix":"","ssl_verify":true},"need_reload":false,"health_check_timeout":10,"values_hash":{},"prev_index":517597,"last_err_time":1705053480,"resync_delay":5,"key":"\/apisix\/global_rules","automatic":true,"running":true,"sync_times":1,"last_err":"timeout"},"upstream_key":"roundrobin#upstream_table:
 0x7f8403467120","conf_type":"route","matched_route":"table: 
0x7f84034675c0","curr_req_matched":{":ext":"50M","_method":"GET","_path":"\/*"},"var":{"_request":"cdata<void
 *>: 
0x022f70c0","_cache":{"upstream_scheme":"http","host":"192.168.8.110","request_method":"GET","remote_addr":"192.168.8.110","uri":"\/50M"}},"conf_id":"1","upstream_healthcheck_parent":"table:
 
0x7f84034675c0","route_id":"1","upstream_conf":{"nodes":[{"priority":0,"port":6677,"host":"172.17.0.1","weight":1}],"hash_on":"vars","scheme":"http","pass_host":"pass","parent":{"orig_modifiedIndex":517595,"modifiedIndex":517595,"value":{"priority":0,"create_time":1703600830,"status":1,"uri":"\/*","update_time":1
 705053359,"id":"1","plugins":{"example-plugin":{"i":10}},"upstream":"table: 
0x7f8403467120"},"key":"\/apisix\/routes\/1","createdIndex":492835,"clean_handlers":{},"update_count":0,"has_domain":false},"type":"roundrobin","nodes_ref":"table:
 
0x7f84033e4eb0","original_nodes":[{"port":6677,"weight":1,"host":"172.17.0.1"}]},"plugins":[{"priority":0,"check_schema":"function:
 
0x7f84047880c8","schema":{"required":["i"],"type":"object","properties":{"i":{"minimum":0,"type":"number"},"s":{"type":"string"},"ip":{"type":"string"},"disable":{"type":"boolean"},"port":{"type":"integer"},"t":{"minItems":1,"type":"array"}},"$comment":"this
 is a mark for our injected plugin schema"},"control_api":"function: 
0x7f84047883d0","init":"function: 0x7f84047881b8","destroy":"function: 
0x7f8404788270","name":"example-plugin","access":"function: 
0x7f8404788318","metadata_schema":{"required":["ikey","skey"],"type":"object","properties":{"skey":{"type":"string"},"ikey":{"minimum":0,"type":"number"}}},"version":0
 .1,"rewrite":"function: 0x7f84047882a0"},"table: 
0x7f8403467068"],"upstream_version":517595}, client: 192.168.8.110, server: _, 
request: "GET /50M HTTP/1.1", host: "192.168.8.110:9080"
   2024/01/12 17:58:09 [info] 3684#3684: *78241 [lua] init.lua:539: 
http_access_phase(): stash ngx ctx: 1, client: 192.168.8.110, server: _, 
request: "GET /50M HTTP/1.1", host: "192.168.8.110:9080"
   2024/01/12 17:58:09 [info] 3684#3684: *78241 [lua] balancer.lua:367: run(): 
proxy request to 172.17.0.1:6677 while connecting to upstream, client: 
192.168.8.110, server: _, request: "GET /50M HTTP/1.1", host: 
"192.168.8.110:9080"
   2024/01/12 17:58:09 [info] 3684#3684: *78241 [lua] init.lua:555: 
fetch_ctx(): fetch ngx ctx: 1 while reading response header from upstream, 
client: 192.168.8.110, server: _, request: "GET /50M HTTP/1.1", upstream: 
"http://172.17.0.1:6677/50M";, host: "192.168.8.110:9080"
   2024/01/12 17:58:09 [info] 3692#3692: *232 [lua] config_etcd.lua:142: 
waitdir(): cancel watch connection success, context: ngx.timer
   2024/01/12 17:58:09 [info] 3692#3692: *232 [lua] config_etcd.lua:328: 
sync_data(): waitdir key: /apisix/consumers prev_index: 517587, context: 
ngx.timer
   2024/01/12 17:58:09 [info] 3692#3692: *232 [lua] config_etcd.lua:329: 
sync_data(): res: null, context: ngx.timer
   2024/01/12 17:58:09 [info] 3687#3687: *116 [lua] v3.lua:649: 
request_chunk(): http request method: POST path: /watch body: 
{"create_request":{"start_revision":517587,"key":"L2FwaXNpeC91cHN0cmVhbXM=","range_end":"L2FwaXNpeC91cHN0cmVhbXQ="}}
 query: nil, context: ngx.timer
   2024/01/12 17:58:09 [info] 3684#3684: *78241 client 192.168.8.110 closed 
keepalive connection
   2024/01/12 17:58:09 [info] 3681#3681: *78278 [lua] timers.lua:39: run 
timer[plugin#error-log-logger], context: ngx.timer
   2024/01/12 17:58:09 [info] 3681#3681: *78278 [lua] error-log-logger.lua:248: 
please set the correct plugin_metadata for error-log-logger, context: ngx.timer
   2024/01/12 17:58:09 [info] 3692#3692: *230 [lua] v3.lua:649: 
request_chunk(): http request method: POST path: /watch body: 
{"create_request":{"start_revision":517587,"key":"L2FwaXNpeC9wbHVnaW5fY29uZmlncw==","range_end":"L2FwaXNpeC9wbHVnaW5fY29uZmlndA=="}}
 query: nil, context: ngx.timer
   2024/01/12 17:58:09 [info] 3685#3685: *78281 [lua] timers.lua:39: run 
timer[plugin#error-log-logger], context: ngx.timer
   2024/01/12 17:58:09 [info] 3685#3685: *78281 [lua] error-log-logger.lua:248: 
please set the correct plugin_metadata for error-log-logger, context: ngx.timer
   2024/01/12 17:58:09 [info] 3688#3688: *78282 [lua] timers.lua:39: run 
timer[plugin#error-log-logger], context: ngx.timer
   
   ```
   


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

Reply via email to