Skip to content
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

Support ActiveSupport::RedisCacheStore #340

Closed
wants to merge 1 commit into from
Closed

Support ActiveSupport::RedisCacheStore #340

wants to merge 1 commit into from

Conversation

brian-kephart
Copy link
Contributor

Fixes #281. Thanks for the good test suite, it prevented many problems. This PR passes Travis & Rubocop.

@grzuy grzuy self-requested a review May 15, 2018 13:49
@grzuy
Copy link
Collaborator

grzuy commented May 15, 2018

Fixes #281.

Thanks!

Thanks for the good test suite, it prevented many problems.

Thank a lot for the feedback. I especially appreciate you noticing that, given that making the test suite robust was the main focus a couple of months ago (#293). Any other feedback about ways to improve are very welcomed!

This PR passes Travis & Rubocop.

Thanks for checking rubocop also.

@grzuy
Copy link
Collaborator

grzuy commented May 15, 2018

I want to code review and test this a bit more before merging. Will do as soon as I can. Will let you know.
Thanks again.

@brian-kephart
Copy link
Contributor Author

Sounds good. Let me know if you have questions, or if anything's unclear.

@brian-kephart
Copy link
Contributor Author

I change my initializer to:

throttle('req/ip', :limit => 2, :period => 10) do |req|
  req.ip # unless req.path.start_with?('/assets')
end

...and now I can reproduce the error reliably. If I have the app running, then stop and restart Redis, the second request produces the error. Subsequent requests reproduce it until the 10sec timeout period expires.

Why? No idea.

@brian-kephart
Copy link
Contributor Author

I put the repro on github here.

@brian-kephart
Copy link
Contributor Author

Closing. See notes on #281.

@grzuy grzuy removed their request for review May 18, 2018 14:16
@morgoth
Copy link

morgoth commented Jun 19, 2018

@brian-kephart I'm just debugging issues with Rails 5.2 using built in Redis cache handler and rack attack keys in Redis that don't expire. It looks like your PR could fix it. Why it was closed?

@brian-kephart
Copy link
Contributor Author

The only errors I could reliably reproduce were solved another way, see #281 as mentioned above. I haven't seen these errors again despite weeks of use.

I think @grzuy would be open to merging this, but only with a reliable repro and a test. Current tests pass using the RedisCacheStore, so if it's really not working then there's something not covered by the tests.

@grzuy
Copy link
Collaborator

grzuy commented Jun 19, 2018

@brian-kephart @morgoth I was able to add a test reproducing the issue, see commits in #350.

This PR can no longer be merged because the original repo was deleted. I am cherry-picking the commit anyways.

Thank you both!

@brian-kephart
Copy link
Contributor Author

Thanks @grzuy for your patience and persistence on this!

tigefa4u pushed a commit to tigefa4u/gitlabhq that referenced this pull request Aug 22, 2019
`ActiveSupport::Cache::RedisCacheStore` is not compatible with the
version of Rack Attack we are using (v4.4.1) per
rack/rack-attack#281. Users that had
rate limits enabled might see `Redis::CommandError: ERR value is not an
integer or out of range` because the `raw` parameter wasn't passed along
properly.

Let's partially revert the change to the original cache store until we
can update to Rack Attack v5.2.3 that has support for
`ActiveSupport::Cache::RedisCacheStore` via
rack/rack-attack#340.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support RedisCacheStore (new in Rails 5.2)
3 participants