-
Notifications
You must be signed in to change notification settings - Fork 16
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
EdgeOS - Memory Leak with HTTPS (TYPE65) record queries #61
Comments
Could this be the cause of the memory leak? Maybe the provided hint could be used to stabilize memory usage? |
Can you provide some details on this memory leak? How do you determine that this is the case? Please provide any and all details you have. |
Well, ctrld starts growing (initial memory usage ~6% router memory and then more than 20%) once you use it with Safari or Chrome. If you switch on "debug" mode, you will see many "HTTPS" record queries from the browsers in addition to "A" and "AAAA" queries in the log. Just use "top" on the command line to check memory usage. Without "HTTPS" record queries from browsers, ctrld appears to be quite stable growing from ~6% to just ~7% router memory during one day. |
Can you please provide exact outputs that you see. We need specific details. |
When reloading a web page, the response times in the ctrld log show that for "HTTPS" there are no cache hits while for "A" and "AAAA" there are cache hits. So, the cache does not seem to work with "HTTPS" queries. |
Just test ctrld with Safari or Chrome. |
We have, unable to reproduce the issue. Which is why I asked for details. |
I have pointed my Mac mini (newest MacOS, newest Safari, newest Chrome) to ctrld on EdgeRouter X (newest firmware v2.0.9-hotfix.6) for DNS and tested by opening & refreshing news web pages: spiegel.de, focus.de, macrumors.com ctrld config:
Here some memory values for approx. 10 minutes:
Memory usage starts with 15584 KiB and increases to 18516 KiB within 12 minutes of testing. In the debug log file ctrld.debug.log, you can see the mentioned HTTPS queries. Hope this helps! |
@7pps is it reproducible if you don't use cache? |
Here some memory values without cache:
After some growth within the first minutes, the used memory appears to settle at 17376 KiB. |
Memory is leaking during network outages as well (ctrld on EdgeRouter X, see above).
Used memory jumps from 7.6% up to 21.2%. It would be great if ctrld would be more well-behaved on memory because high memory usage leads to an overall slow down of the router, including crashes of ctrld. |
@7pps is memory back to normal after internet connection restored? |
No, it remains large as you can see from the log. The network outage happens between 04:00 and 04:01 (this is time hh:mm). Maybe query errors lead to wasted memory? But memory resizing could be one way of implementing it: trigger a memory purge/flush once it has grown too large, like a restart that keeps valid cache entries but otherwise frees up allocated memory. |
Can you please try the latest release and see if the issue is resolved? https://github.com/Control-D-Inc/ctrld/releases/tag/v1.3.0 |
I have tried to use v1.3.0 but get the following errors:
I have noticed that the file For the time being I have returned to v1.2.1. |
The error is quite clear: you have something (dnsmasq probably) listening on 127.0.0.1:53 already. As you're running You can either:
The reason why v1.2.1 may work for you, because it does not follow standards. v1.3.0 does. |
Well, dnsmasq is listening on port 53 before ctrld is started (which is correct for EdgeRouter without ctrld). v1.2.1 moves it to port 5354:
This should also be done by v1.3.0 or do you want to introduce manual steps? |
Yes, that is the non-standard behavior I mentioned. In local config mode, You need to do one of the 2 solutions I mentioned above. |
If you edit your ctrld.toml config and choose any non-conflicting port except 53 (like 5354), it will work. |
Ok, I have added I am using 3 subnets on different VLANs. With
After configuring
Is there any need for listening on HTTPS queries are answered with cache hits which did not work in v1.2.1. |
Picking of subnets/gateways is outside the scope of ctrld, this is controlled by you on your network. dnsmasq listens on 127.0.0.1:53, so ctrld can't listen on that, unless you kill dnsmasq. |
I have moved dnsmasq to port 5354:
Is that an issue? It would be nice, if there would not be a potentially unwanted listener on a randomly chosen default gateway but just the |
After changing the port of Regarding memory, ctrld is in general still slowly growing and heavily expanding during internet outages:
Used memory increases within 2 minutes to about twice the size. |
Do you have caching enabled? |
Yes, cache size 1000. |
If you disable the cache, is the memory usage more static? |
It is about the same without cache.
Without cache used memory increased more than 4x during 2 minutes of internet outage. |
I have upgraded to ctrld 1.3.1 and the memory leak appears to be fixed. Thanks for the great work!
|
@7pps How can you tell its fixed if you're restarting it every day? |
Well, as you can see from the log, PID 16002 started with RSS ~21K and returns again and again to RSS ~21K. It also does so, if it runs for more than 24h. To renew internet connection every 24h is just common practice here. Best Regards! |
I have ctrld installed on EdgeRouter X and it is running fine for "normal" DNS queries, e.g. A records via dig.
However, once you open some websites in browsers like Safari or Chrome, the memory of ctrld starts to grow. I have tried cache sizes 100, 300, 1000.
As far as I can see, this appears to be related to HTTPS (TYPE65) record queries. The used memory of ctrld may easily increase to more than 20% of router memory - until ctrld crashes. If the browsers are configured to use other DNS servers, ctrld runs fine with a very slow memory growth, e.g. DNS for Sonos, Printer, NAS.
Could HTTPS (TYPE65) records be excluded from caching or the cache be checked for memory leaks?
Please test it by pointing Chrome to ctrld for DNS.
Thanks & Best Regards!
The text was updated successfully, but these errors were encountered: