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

Tweak rate-limiting #1199

Merged
merged 9 commits into from
Oct 3, 2021
Merged

Tweak rate-limiting #1199

merged 9 commits into from
Oct 3, 2021

Conversation

DL6ER
Copy link
Member

@DL6ER DL6ER commented Oct 3, 2021

By submitting this pull request, I confirm the following:

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.

How familiar are you with the codebase?:

10


This PR tweaks rate-limiting by ensuring clients are not unblocked after the configured interval if they are continuously querying and, hence, deserve continued blocking.

Interesting side-effect: I forgot about this change, sorry. If we'd have it in the current release, #1197 would not have even happened (it is fixed herein as well, even if differently). Nonetheless, it still makes sense to also merge #1197

…ited. If they are still querying like hell, they will never get un-blocked again.

Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
…ally triggered. This caused every device to be rate-limited sooner or later. This should not happen.

Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
@DL6ER DL6ER requested a review from a team October 3, 2021 12:56
Copy link
Member

@yubiuser yubiuser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected. I've a rate limit of 1000 queries in 60 seconds.

Sending 1000 and than stopping:

[2021-09-22 21:03:24.070 27865M] Rate-limiting 10.0.1.39 for at least 48 seconds
[2021-09-22 21:04:12.756 27865/T27870] Ending rate-limitation of 10.0.1.39

Sending 1000 and than again 1000 while still blocked (within the initial block periode) :

[2021-09-22 21:07:18.510 27865M] Rate-limiting 10.0.1.39 for at least 54 seconds
[2021-09-22 21:08:12.008 27865/T27870] Still rate-limiting 10.0.1.39 as it made additional 1076 queries
[2021-09-22 21:09:12.071 27865/T27870] Ending rate-limitation of 10.0.1.3

Sending 1000 and than again 1000 while still blocked (within the initial block periode) and 1000 in the "still-blocked periode" :

[2021-09-22 21:13:01.541 27865M] Rate-limiting 10.0.1.39 for at least 11 seconds
[2021-09-22 21:13:12.324 27865/T27870] Still rate-limiting 10.0.1.39 as it made additional 1048 queries
[2021-09-22 21:14:12.388 27865/T27870] Still rate-limiting 10.0.1.39 as it made additional 1221 queries
[2021-09-22 21:15:12.451 27865/T27870] Ending rate-limitation of 10.0.1.39

Sending 1000, waiting for 1 minute (getting unblocked) and then immediately sending another 1000

[2021-09-22 21:10:28.018 27865M] Rate-limiting 10.0.1.39 for at least 44 seconds
[2021-09-22 21:11:12.197 27865/T27870] Ending rate-limitation of 10.0.1.39
[2021-09-22 21:11:17.546 27865M] Rate-limiting 10.0.1.39 for at least 55 seconds
[2021-09-22 21:12:12.261 27865/T27870] Ending rate-limitation of 10.0.1.39

@DL6ER DL6ER merged commit f9cde98 into development Oct 3, 2021
@DL6ER DL6ER deleted the tweak/rate_limiting branch October 3, 2021 17:17
@DL6ER DL6ER linked an issue Oct 4, 2021 that may be closed by this pull request
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/pi-hole-ftl-v5-11-web-v5-8-and-core-v5-6-released/50566/1

@yubiuser yubiuser mentioned this pull request Jan 16, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FTL crash when rate-limiting
3 participants