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 2022/10/31 16:27:01 UTC

[GitHub] [apisix] yalcinyildiz opened a new issue, #8218: bug: limit-count plugin doesn't work correctly for grpc services when used with proxy-cache plugin in the same route

yalcinyildiz opened a new issue, #8218:
URL: https://github.com/apache/apisix/issues/8218

   ### Current Behavior
   
   APISIX limit-count plugin loses the hit count for grpc services, if it is used with proxy-cache plugin with memory cache strategy.
   
   ### Expected Behavior
   
   APISIX limit-count plugin should manage the hit count correctly in every condition
   
   ### Error Logs
   
   None
   
   ### Steps to Reproduce
   
   You can follow the documentation attached to reproduce the error.
   
   [limit-count.plugin.problem.pdf](https://github.com/apache/apisix/files/9902790/limit-count.plugin.problem.pdf)
   [config.yaml.txt](https://github.com/apache/apisix/files/9902791/config.yaml.txt)
   [docker-compose.yml.txt](https://github.com/apache/apisix/files/9902792/docker-compose.yml.txt)
   [hello.proto.txt](https://github.com/apache/apisix/files/9902793/hello.proto.txt)
   
   
   ### Environment
   
   - APISIX version (run `apisix version`): apache/apisix:2.15.0-alpine docker image
   - Operating system (run `uname -a`): Linux 5ea97a156183 5.10.16.3-microsoft-standard-WSL2 # 1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 Linux
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): built by gcc 10.3.1 20210424 (Alpine 10.3.1_git20210424) built with OpenSSL 1.1.1g  21 Apr 2020
   


-- 
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: notifications-unsubscribe@apisix.apache.org.apache.org

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


[GitHub] [apisix] yalcinyildiz commented on issue #8218: bug: limit-count plugin doesn't work correctly for grpc services when used with proxy-cache plugin in the same route

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

   > > Until we reach the cache_ttl value;
   > > 
   > > * When I invoke the service endpoint more than once, the "x-ratelimit-remaining" response header disappears
   > > * I can also hit the service endpoint more than the "x-ratelimit-limit" count.
   > 
   > The priority of the `proxy-cache` plugin is higher than that of the `limit-count` plugin. When the cache hits, the `proxy-cache` will directly send the cached content to the client, and the `limit-count` plugin will not be executed.
   
   Ok, I see, but what if we want to limit user requests even when the cache mechanism is used? I believe such a scenario should be practical. 
   
   
   > > 2.3.1 First call for the route
   > > apisix-cache-status response header is missing.
   > 
   > From your configuration I see no problem, so please confirm the problem:
   > 
   > 1. Is there any related error log?
   There is no log in error.log file. Here are the logs ithe n access.log file.
   
   172.28.0.1 - - [01/Nov/2022:10:49:39 +0000] localhost:9079 "POST /hello.HelloGrpc/SayHello HTTP/2.0" 200 20 0.030 "-" "grpc-dotnet/2.42.0 (.NET 6.0.8; CLR 6.0.8; net6.0; windows; x64)" 192.168.1.78:9000 200 0.030 "grpc://192.168.1.78:9000"
   172.28.0.1 - - [01/Nov/2022:10:49:43 +0000] localhost:9079 "POST /hello.HelloGrpc/SayHello HTTP/2.0" 200 20 0.000 "-" "grpc-dotnet/2.42.0 (.NET 6.0.8; CLR 6.0.8; net6.0; windows; x64)" - - - "http://localhost:9079"
   
   > 2. Whether the request received the expected status code, etc.
   I expect to see a HttpStatus 429 when the user reaches the limit because to use cache or not is the choice of the apisix dashboard user.


-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] soulbird commented on issue #8218: bug: limit-count plugin doesn't work correctly for grpc services when used with proxy-cache plugin in the same route

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

   > Until we reach the cache_ttl value;
   > - When I invoke the service endpoint more than once, the "x-ratelimit-remaining" response header disappears
   > - I can also hit the service endpoint more than the "x-ratelimit-limit" count.
   
   The priority of the proxy-cache plugin is higher than that of the limit-count plugin. When the cache hits, the proxy-cache will directly send the cached content to the client, and the limit-count plugin will not be executed.
   
   > 2.3.1 First call for the route
   >  apisix-cache-status response header is missing.
   
   From your configuration I see no problem, so please confirm the problem:
   1. Is there any related error log?
   2. Make sure the peoxy-cache plugin is enabled, it is disabled by default
   3. Whether the request received the expected status code, etc.


-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] yalcinyildiz closed issue #8218: bug: limit-count plugin doesn't work correctly for grpc services when used with proxy-cache plugin in the same route

Posted by GitBox <gi...@apache.org>.
yalcinyildiz closed issue #8218: bug: limit-count plugin doesn't work correctly for grpc services when used with proxy-cache plugin in the same route
URL: https://github.com/apache/apisix/issues/8218


-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tokers commented on issue #8218: bug: limit-count plugin doesn't work correctly for grpc services when used with proxy-cache plugin in the same route

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

   See https://apisix.apache.org/blog/2022/07/29/release-apache-apisix-2.15/#custom-plugin-priority.


-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] yalcinyildiz commented on issue #8218: bug: limit-count plugin doesn't work correctly for grpc services when used with proxy-cache plugin in the same route

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

   > > Ok, I see, but what if we want to limit user requests even when the cache mechanism is used? I believe such a scenario will be practical.
   > 
   > It's OK to customize the plugin priority with the field _meta.priority. You can assign a higher priority for limit-count plugin.
   
   Hi. If I understand correctly, users need to specify the priority of the plugins themselves. But what should I do to achieve it?
   
   I added plugins section to my config.yaml file, and reduced the priority of the proxy-cache plugin, but the behaviour hasn't changed. You can see the updated file below.
   
   [config.yaml.updated.txt](https://github.com/apache/apisix/files/9927450/config.yaml.updated.txt)
   


-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] yalcinyildiz commented on issue #8218: bug: limit-count plugin doesn't work correctly for grpc services when used with proxy-cache plugin in the same route

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

   Thanks for your guidance, it works! Here is the latest configuration of the route.
   
   [route.updated.json.txt](https://github.com/apache/apisix/files/9935929/route.updated.json.txt)
   


-- 
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: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tokers commented on issue #8218: bug: limit-count plugin doesn't work correctly for grpc services when used with proxy-cache plugin in the same route

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

   > Ok, I see, but what if we want to limit user requests even when the cache mechanism is used? I believe such a scenario will be practical.
   
   It's OK to customize the plugin priority with the field _meta.priority. You can assign a higher priority for limit-count plugin.


-- 
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: notifications-unsubscribe@apisix.apache.org

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