-
Notifications
You must be signed in to change notification settings - Fork 920
dnsdist: addAction/rmRule/newServer/rmServer leak memory #9372
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
Comments
@Habbie for the newServer leak memory, I followed the call trace, and I found that when configure a newServer , dnsdist will add a response thread, but after the rmServer(x), the response thread still keep running, each thread lead to 10M byte memory leak. |
I see two different things going on, that might be related:
We should first make sure that the responder thread eventually stops after the corresponding backend has been removed. This might also solve the issue with the rules since that thread might never update to a newer version once the backend has been removed. |
So:
|
Thanks for reporting the issue and for testing the fixes, much appreciated! |
Short description
We have tested dnsdist as DNS load balance.
We frequently add/delete rules or servers.
and we found that when frequently add/delete rules/servers will lead to memory leak.
Environment
Steps to reproduce
makerule_test.sh: add and delete the same rule 4000 times
server.sh: add and delete the same server 200 times.
server.lua: add new server and delete it
v1.4 server.sh:
v1.5 server.sh:
makerule_test.sh:
generate_ip.sh: create a IP list configuration
bash generate_ip.sh 15000 >ip.conf
dist_rule.py: the arg is a ip list file, and will generate a single rule with 15000 IPs
python3 dist_rule.py ip.conf > makerule_15000.lua
makerule_test.sh: add and delete the same rule x times
step 3: add and delete the same rule lead to memory leak.
and this step will add more IPs to a single rule, and delete old rule.
example: addAction(A, PoolAction(""))
a) first rule: with old IP set A : 15000 IPs
b) new rule: new IP set B: add two IPs to A
c)delete the first rule
Expected behaviour
add and delete the same rule will not increase memory usage.
add new rule and delete old rule will increase a little memory usage.
add and delete the same server will not increase memory usage.
Actual behaviour
step 3: add and delete the same rule
$ bash makerule_test.sh 4000
output:
start: 97356 end: 949800
832
result: increased 832M byte memory!
step 5: add and delete the same server
$ bash server.sh 200
output:
start: 97156 end: 3889156
3703
result: increased 3703M byte memory!
step 6:
this also lead to memory leak
Other information
issues/8530: dnsdist: addAction/rmRule consumes incrementally more memory
dnsdist -c -C ./dnsdist.conf < makerule_15000.lua will add log to ~/.dnsdist_history, in the test, we clear the history file per second.
The text was updated successfully, but these errors were encountered: