Open Fijxu opened 1 month ago
After profiling netclient with pprof
. The heap usage showed that the func ParseHosts
was using a lot of memory. The main reason what that my hosts file has more than 400K entries (blocked domains).
https://github.com/gravitl/txeh/blob/3778c58bd69f81aa845bda0d5149532d6bc5e0bb/txeh.go#L351
$ wc -l /etc/hosts
451343 /etc/hosts
After deleting all entries and leaving only the essential ones, netclient no longer uses a huge amount of CPU and memory. This is still an issue, so if you guys are going to address it, keep this open. Does netclient really needs to parse all the entries on the hosts file?
When using
netclient daemon
or the systemd service, the CPU and RAM usage increases until the process is killed. Sadly I have no clue why this happens. I already tried and checked a few things:iptables
netclient daemon
works perfectly on my 5 machines, no CPU usage nor high RAM usage; my laptop is the only machine with this problem."verbosity": 3
and"debug": true
logs:The high CPU usage starts at
[netclient] YYYY-MM-DD HH:MM:SS adding forwarding rule
lineI can give more debug information if I can get some insight on how to do it. Thanks!