-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
Customizable locking while database is busy #1156
Conversation
…atabase is not available Signed-off-by: DL6ER <[email protected]>
… the entire answer Signed-off-by: DL6ER <[email protected]>
…tially (incl. when forking a TCP worker) Signed-off-by: DL6ER <[email protected]>
Signed-off-by: DL6ER <[email protected]>
This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there: https://discourse.pi-hole.net/t/behavior-when-database-is-busy/48174/25 |
Connected web PR: pi-hole/web#1869 |
Connected doc PR: pi-hole/docs#554 |
Sounds like a great idea to me. |
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-9-web-v5-6-and-core-v5-4-released/49544/1 |
This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there: https://discourse.pi-hole.net/t/pi-hole-allows-blacklisted-queries-through-on-reboot/52312/12 |
By submitting this pull request, I confirm the following:
How familiar are you with the codebase?:
10
When the gravity database is locked/busy, Pi-hole allows all queries because it has no way of detecting if they should be blocked or not. However, for very large lists and/or on very busy networks and/or on very (!) slow devices, this may open a windows of up to several seconds where undesired queries may get through, ads and unwanted telemetry could be the result.
This PR adds a config option (
REPLY_WHEN_BUSY
) to customize what happens to queries while the database is locked:ALLOW
- as before, just allow all queries when the database is busyBLOCK
- block all queries when the database is busy. This uses the configuredBLOCKINGMODE
(defaultNULL
)REFUSE
- refuse all queries which arrive while the database is busyDROP
- just drop the queries, i.e., never reply to them at all.In my opinion, option 4 is the best one because it will typically cause clients to retry the query after some timeout of typically a few seconds. I.e., the DNS resolution will only be delayed but we do never hand out incorrectly either allowed or blocked queries.
REFUSE
first sounded like a good option, too, however, it turned out that many clients will just immediately retry, causing up to several thousands of queries per second. This does not happen inDROP
mode.