-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
limits > 2.0.3 breaks with Redis Sentinel #97
Comments
I believe the bug is that this line (https://github.com/alisaifee/limits/blob/master/limits/storage/redis_sentinel.py#L70) does NOT have a See how it looked before the redesign at limits/limits/storage/redis_sentinel.py Line 54 in 45f0dd7
Matter of fact I have tested it by monkey-patching and once I add that line, the issue goes away. |
Thanks for the report and my apologies for the backward incompatibility - this was entirely unintentional. The behaviour in version < 2.1 was incorrect and had resulted in people having to workaround by supplying the password for the master/slave nodes in the uri and passing the password for the sentinel (correctly) in the The "expected" way to pass the parameters when both the sentinel and the master/slave are password protected would be either:
or
At the moment I don't have any clear idea on how to add a patch that would be backward compatible as well as encourage the correct behaviour - I'm wondering if this can be communicated via documentation/release notes. Open to suggestions though! |
Thanks. These things happen. Thanks again for looking into this and providing the workaround. |
After thinking about this a bit more I think a backward compatible implementation is possible. I've pushed something to master (65041d4) - and I think it should handle most use cases (though I definitely need to update the documentation to list out very concrete examples). Once you've had a chance to take a look and if it looks fine - I can do a dot release so that more users don't hit this accidentally. |
Thanks, I think it looks good! |
For future readers this issue exists for limits versions |
v2.7.1 ------ Release Date: 2022-10-20 * Compatibility Updates * Increase pymemcached dependency range to in include 4.x * Add python 3.11 rc2 to CI v2.7.0 ------ Release Date: 2022-07-16 * Compatibility Updates * Update :pypi:`coredis` requirements to include 4.x versions * Remove CI / support for redis < 6.0 * Remove python 3.7 from CI * Add redis 7.0 in CI v2.6.3 ------ Release Date: 2022-06-05 * Chores * Update development dependencies * Add CI for python 3.11 * Increase test coverage for redis sentinel v2.6.2 ------ Release Date: 2022-05-12 * Compatibility Updates * Update :pypi:`motor` requirements to include 3.x version * Update async redis sentinel implementation to remove use of deprecated methods. * Fix compatibility issue with asyncio redis ``reset`` method in cluster mode when used with :pypi:`coredis` versions >= 3.5.0 v2.6.1 ------ Release Date: 2022-04-25 * Bug Fix * Fix typing regression with strategy constructors `Issue 88 <https://github.com/alisaifee/limits/issues/88>`_ v2.6.0 ------ Release Date: 2022-04-25 * Deprecation * Removed tests for rediscluster using the :pypi:`redis-py-cluster` library * Bug Fix * Fix incorrect ``__slots__`` declaration in :class:`limits.RateLimitItem` and it's subclasses v2.5.4 ------ Release Date: 2022-04-25 * Bug Fix * Fix typing regression with strategy constructors `Issue 88 <https://github.com/alisaifee/limits/issues/88>`_ v2.5.3 ------ Release Date: 2022-04-22 * Chore * Automate Github releases v2.5.2 ------ Release Date: 2022-04-17 * Chore * Increase strictness of type checking and annotations * Ensure installations from source distributions are PEP-561 compliant v2.5.1 ------ Release Date: 2022-04-15 * Chore * Ensure storage reset methods have consistent signature v2.5.0 ------ Release Date: 2022-04-13 * Feature * Add support for using redis cluster via the official redis client * Update coredis dependency to use 3.x * Deprecations * Deprecate using redis-py-cluster * Chores * Remove beta tags for async support * Update code base to remove legacy syntax * Tighten up CI test dependencies v2.4.0 ------ Release Date: 2022-03-10 * Feature * Allow passing an explicit connection pool to redis storage. Addresses `Issue 77 <https://github.com/alisaifee/limits/issues/77>`_ v2.3.3 ------ Release Date: 2022-02-03 * Feature * Add support for dns seed list when using mongodb v2.3.2 ------ Release Date: 2022-01-30 * Chores * Improve authentication tests for redis * Update documentation theme * Pin pip version for CI v2.3.1 ------ Release Date: 2022-01-21 * Bug fix * Fix backward incompatible change that separated sentinel and connection args for redis sentinel (introduced in 2.1.0). Addresses `Issue 97 <https://github.com/alisaifee/limits/issues/97>`_ v2.3.0 ------ Release Date: 2022-01-15 * Feature * Add support for custom cost per hit * Bug fix * Fix installation issues with missing setuptools v2.2.0 ------ Release Date: 2022-01-05 * Feature * Enable async redis for python 3.10 via coredis * Chore * Fix typing issue with strategy constructors v2.1.1 ------ Release Date: 2022-01-02 * Feature * Enable async memcache for python 3.10 * Bug fix * Ensure window expiry is reported in local time for mongodb * Fix inconsistent expiry for fixed window with memcached * Chore * Improve strategy tests v2.1.0 ------ Release Date: 2021-12-22 * Feature * Add beta asyncio support * Add beta mongodb support * Add option to install with extras for different storages * Bug fix * Fix custom option for cluster client in memcached * Fix separation of sentinel & connection args in :class:`limits.storage.RedisSentinelStorage` * Deprecation * Deprecate GAEMemcached support * Remove use of unused `no_add` argument in :meth:`limits.storage.MovingWindowSupport.acquire_entry` * Chore * Documentation theme upgrades * Code linting * Add compatibility CI workflow v2.0.3 ------ Release Date: 2021-11-28 * Chore * Ensure package is marked PEP-561 compliant v2.0.1 ------ Release Date: 2021-11-28 * Chore * Added type annotations v2.0.0 ------ Release Date: 2021-11-27 * Chore * Drop support for python < 3.7
Hi,
I am the maintainer of the Falcon-Limiter package (see https://github.com/zoltan-fedor/falcon-limiter) and one of my users has raised an issue about the Falcon-Limiter breaking when using
limits version 2.3.0
with Redis Sentinel, while it works withllimits version 2.0.3
.See the original issue at zoltan-fedor/falcon-limiter#1
I did manage to reproduce the user's issue in Falcon-Limiter after deploying Redis Sentinel onto my Kubernetes cluster.
Then I went and tested the
limits
library (without theFalcon-Limiter
) and unfortunately I was able to reproduce the same here too, so it seems to me this is an issue with thelimits
library, not with howFalcon-Limiter
makes calls to it. (correct me if I am wrong here)Below is the test code I use:
When running this with
limits version 2.3.0
I get the following error - while there is no error when usingversion 2.0.3
.Does
limits version 2.3.0
require the password for Sentinel to be passed differently?In case you want to reproduce the issue on your side, unfortunately you will need to deploy a Redis Sentinel cluster. There are additional details about that in the original ticket, but just a quick summary:
Based on this test (https://github.com/alisaifee/limits/blob/master/tests/storage/test_redis_sentinel.py#L33) this scenario should work, but obviously it doesn't - likely the mocking is not able to capture the issue.
The text was updated successfully, but these errors were encountered: