apache / apisix

The Cloud-Native API Gateway
https://apisix.apache.org/blog/
Apache License 2.0
13.96k stars 2.45k forks source link

help request: can't hot-reload limit-count #11382

Open ShuLian1984 opened 3 days ago

ShuLian1984 commented 3 days ago

Description

The execution steps are as follows:

  1. Apisix is run, Add the limit-count plugin to the config.yml configuration,and call the plugin reload api
  2. Configure limit-count to take effect on the specified route through apisix dashboard
  3. Request and response an 500 error

response context

<html>

<head>
    <title>500 Internal Server Error</title>
</head>

<body>
    <center>
        <h1>500 Internal Server Error</h1>
    </center>
    <hr>
    <center>openresty</center>
    <p><em>Powered by <a href="https://apisix.apache.org/">APISIX</a>.</em></p>
</body>

</html>

apisix error.log

2024/07/01 18:08:08 [error] 2900479#2900479: *1548899123 lua entry thread aborted: runtime error: .../apisix/apisix/plugins/limit-count/limit-count-local.lua:67: attempt to index field 'limit_count' (a nil value)
stack traceback:
coroutine 0:
        .../apisix/apisix/plugins/limit-count/limit-count-local.lua: in function 'incoming'
        /usr/local/apisix/apisix/plugins/limit-count/init.lua:302: in function 'phase_func'
        /usr/local/apisix/apisix/plugin.lua:1148: in function 'run_plugin'
        /usr/local/apisix/apisix/init.lua:725: in function 'http_access_phase'
        access_by_lua(nginx.conf:356):2: in main chunk, client: 100.123.22.18, server: _, request: "GET /device-manager/v1/qms/device-active/list?startTimestamp=1461686400000&endTimestamp=1461772799999&domain=cn&pageNumber=1&pageSize=100&productKey=96d90227fd8 HTTP/1.1", host: "www.example.com"

Environment

ShuLian1984 commented 3 days ago

All 5 environments are like this,Only after restarting can it function properly.

shreemaan-abhishek commented 2 days ago

you need to run the plugin reload api or reload apisix for hot reload.

ShuLian1984 commented 1 day ago

sorry, I didn't describe it clearly, Add the limit-count plugin to the config.yml configuration,and call the plugin reload api finally,an error record in apisix error.log.

ShuLian1984 commented 1 day ago

apisix reload will cause all TCP long-lived connection to be interrupted due to worker_shutdown_timeout.

Our usage scenario is similar to restarting. so, restart apisix.

ShuLian1984 commented 1 day ago

Did I make a mistake that prevented me from hot-loaded the limit-count plugin through the admin API.