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 2020/08/07 10:12:06 UTC

[GitHub] [apisix] JoeyLee0201 opened a new issue #2019: bug: limit-conn cache never update

JoeyLee0201 opened a new issue #2019:
URL: https://github.com/apache/apisix/issues/2019


   ### Issue description
   Hello, 
   
   I have a consumer who use limit-conn plugin and set value of conn to 10,
   
   But when I update the value of conn, like 20. It will still limit connection number to 10.
   
   I find there is a cache mechanism in this plugin like:
   
   ![image](https://user-images.githubusercontent.com/12098805/89635146-22b4d280-d8d9-11ea-8e51-2414a50f655d.png)
   
   How could I fix this problem?
   
   Also, what's the structure of lim?
   
   Could I get the value of conn in lim, thus I can compare like:
   
   if lim.conn ~= conf.conn then
         ....
   
   ### Environment
   
   * apisix version (cmd: `apisix version`): 1.4
   * OS: docker image
   
   ### Minimal test code / Steps to reproduce the issue
   1.
   2.
   3.
   
   ### What's the actual result? (including assertion message & call stack if applicable)
   
   
   
   ### What's the expected result?
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] membphis closed issue #2019: bug: limit-conn cache never update

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


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] JoeyLee0201 commented on issue #2019: bug: limit-conn cache never update

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


   I have solve this problem.
   just " lim:set_conn(conf.conn)" to make sure the value of conn is the newest.
   
   see doc about "resty.limit.conn" for more information:
   https://github.com/openresty/lua-resty-limit-traffic/blob/master/lib/resty/limit/conn.md#set_conn


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] JoeyLee0201 commented on issue #2019: bug: limit-conn cache never update

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


   In case code image doesn't, here is cache mechanism below:
   
   local lim, err = core.lrucache.plugin_ctx(plugin_name, ctx,
                                                 create_limit_obj, conf)


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] membphis commented on issue #2019: bug: limit-conn cache never update

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


   Do we need to update the source code of the plugin `limit-conn` ?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] membphis commented on issue #2019: bug: limit-conn cache never update

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


   @JoeyLee0201 https://github.com/apache/apisix/pull/2028
   
   I submitted a PR to fix this issue. Welcome to make a try.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] JoeyLee0201 commented on issue #2019: bug: limit-conn cache never update

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


   Yes,  it's a bug  which should be treat seriously. And I don't think my way is the best one.
   The cache will be update in lrucache.lua,if apisix find conf.version is not the same with obj version.
   But, the version seems not be updated when changing consumer's plugins. 
   
   So, I think a good way is to make sure conf.version will be update, thus when load cache, it will know context has been changed, then create a new limit object.
   
   It's just my suggestion, actually I don't know much detail behind the program, maybe there exist another better way.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] JoeyLee0201 edited a comment on issue #2019: bug: limit-conn cache never update

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


   In case code image doesn't show, here is cache mechanism below:
   
   local lim, err = core.lrucache.plugin_ctx(plugin_name, ctx, create_limit_obj, conf)


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] JoeyLee0201 closed issue #2019: bug: limit-conn cache never update

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


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] JoeyLee0201 edited a comment on issue #2019: bug: limit-conn cache never update

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


   In case code image doesn't show, here is cache mechanism below:
   
   local lim, err = core.lrucache.plugin_ctx(plugin_name, ctx,
                                                 create_limit_obj, conf)


----------------------------------------------------------------
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:
users@infra.apache.org