Closed laszlojau closed 3 years ago
@laszlojau, thank you for taking the time to figure out a workaround for processing arger lists. My preference is not to use the debug.runtime as a fix. You should also be able to achieve the same result without changing the code like this:
GOGC=20 /config/scripts/update-dnsmasq -v
Thank you for your help. Sorry, forgot to reply with my findings.
I have changed the scheduled task to include GOGC=20
as per your comment and it has been working perfectly these past few months.
set system task-scheduler task update_blacklists executable path "GOGC=20 /config/scripts/update-dnsmasq-cronjob.sh"
The only caveat is that it throws the following error when you issue the command:
sh: line 0: [: GOGC=20: binary operator expected
Warning: 'GOGC=20' lies outside of /config/scripts/update-dnsmasq-cronjob.sh directory. It will not get preserved during image upgrade.
But it seems like it can be safely ignored, as the generated cron spec is valid:
0 0 */1 * * root GOGC=21 /config/scripts/update-dnsmasq-cronjob.sh 10800
It also works for a USG, the below line has to be changed in config.gateway.json
:
"path": "GOGC=20 /config/scripts/update-dnsmasq-cronjob.sh"
First of all, thank you for creating this application. It is really awesome to be able to use blocklists without any extra hardware.
I have recently been having issues with an USG. The application runs out of memory before completion. I was using v1.2.4.2, and I tried upgrading to v1.2.4.5, but it didn't help. I tried rebooting and re-running the update task, but it ran out of memory again.
I don't know much about Go development, but I tried to do some debugging.
I was using the following command in each test case:
time /config/scripts/update-dnsmasq -v
And while the script was running, I was watching memory usage in another session:watch free -h
RAM before running the script (in each test case)
Test case for v1.2.4.5
The least amount of free memory after
Total entries dropped
, right before the error:Time:
Test case: GC 20%
I've added 2 lines in
main.go
in the latestmaster
branch:I've built with
make mips
and SCP'd the executable to the USG.It took a longer time to finish, but it never ran out of memory this way.
Sample run with GC 20%:
The least amount of free memory after
Total entries dropped
:Memory freed by GC:
Memory before completion:
Time: