jakubzieba commented on issue #13454:
URL: https://github.com/apache/apisix/issues/13454#issuecomment-4610392336
We found this error while testing a staging configuration using the
limit-count plugin before deploying it to production. We are using Docker /
Docker Compose to run APISIX and Redis.
This can be easily reproduced by setting nginx.worker_processes to 1
```yaml
nginx_config:
worker_processes: 1
```
and configuring two routes as follows:
```json
{
"name": "route-1",
"uri": "/route-1",
"upstream": {
"type": "roundrobin",
"nodes": {
"web1:80": 1
}
},
"plugins": {
"proxy-rewrite": {
"uri": "/icas-jwt-auth.php"
},
"limit-count": {
"rejected_code": 429,
"policy": "redis",
"rejected_msg": "too many requests",
"redis_host": "redis-master",
"redis_port": 56379,
"redis_database": 1,
"count": 10,
"time_window": 60,
"key": "remote_addr"
}
}
}
```
```json
{
"name": "route-2",
"uri": "/route-2",
"upstream": {
"type": "roundrobin",
"nodes": {
"web1:80": 1
}
},
"plugins": {
"proxy-rewrite": {
"uri": "/icas-jwt-auth.php"
},
"limit-count": {
"rejected_code": 429,
"policy": "redis",
"rejected_msg": "too many requests",
"redis_host": "redis-master",
"redis_port": 56379,
"redis_database": 2,
"count": 10,
"time_window": 60,
"key": "remote_addr"
}
}
}
```
Once running, simply send a request to /route-1, wait 2–3 seconds, and then
send a request to /route-2. You will then see that in the Redis database with
index 1, two keys are created—for both route-1 and route-2—even though route-2
should be in database 2.
When we first noticed this, we had more of these similar routes (with
different database ids). We were sending requests parallelly to random routes
and noticed that the limits were not working properly. This led us to look into
the source code, which is how we discovered this connection pool issue. After
applying the fix I submitted above, everything started working as expected.
--
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]