fix(core): optimize sing-box memory limits, eliminate SIGHUP memory thrashing, and harden zapret2 recovery (1.3.20)

This commit is contained in:
Dushnilin
2026-09-04 18:58:31 +03:00
parent e1321dd929
commit 78bdd0b412
11 changed files with 123 additions and 72 deletions
+9 -11
View File
@@ -877,9 +877,13 @@ function managed_sing_box_service_text() {
" elif [ \"$mem_total_kb\" -lt 524288 ]; then\n" +
" mem_limit_mb=$(( mem_total_kb / 1024 * 40 / 100 ))\n" +
" gogc=30\n" +
" elif [ \"$mem_total_kb\" -lt 1048576 ]; then\n" +
" mem_limit_mb=$(( mem_total_kb / 1024 * 35 / 100 ))\n" +
" [ \"$mem_limit_mb\" -gt 384 ] && mem_limit_mb=384\n" +
" gogc=40\n" +
" else\n" +
" mem_limit_mb=$(( mem_total_kb / 1024 * 30 / 100 ))\n" +
" [ \"$mem_limit_mb\" -gt 256 ] && mem_limit_mb=256\n" +
" mem_limit_mb=$(( mem_total_kb / 1024 * 40 / 100 ))\n" +
" [ \"$mem_limit_mb\" -gt 768 ] && mem_limit_mb=768\n" +
" gogc=40\n" +
" fi\n" +
" if [ -r \"/etc/tachyon/mem_scale\" ]; then\n" +
@@ -890,7 +894,7 @@ function managed_sing_box_service_text() {
" [ \"$mem_limit_mb\" -lt 12 ] && mem_limit_mb=12\n" +
" fi\n" +
" fi\n" +
" procd_set_param env GOMEMLIMIT=\"${mem_limit_mb}MiB\" GOGC=\"$gogc\"\n" +
" procd_set_param env GOMEMLIMIT=\"${mem_limit_mb}MiB\" GOGC=\"$gogc\" GODEBUG=\"madvdontneed=1\"\n" +
" fi\n" +
" procd_set_param term_timeout 15\n" +
" procd_set_param respawn\n" +
@@ -2456,10 +2460,7 @@ function reinstall_tachyon() {
if (file_exists("/etc/init.d/rpcd"))
command_success_from_args([ "/etc/init.d/rpcd", "reload" ]);
if (!tachyon_status_running_with_timeout())
restart_tachyon_after_successful_change();
else
updates_log("Tachyon is already running after package installation");
restart_tachyon_after_successful_change();
clear_version_caches();
let new_version = installed_package_version("tachyon");
if (new_version == "")
@@ -2506,10 +2507,7 @@ function install_tachyon() {
if (file_exists("/etc/init.d/rpcd"))
command_success_from_args([ "/etc/init.d/rpcd", "reload" ]);
if (!tachyon_status_running_with_timeout())
restart_tachyon_after_successful_change();
else
updates_log("Tachyon is already running after package installation");
restart_tachyon_after_successful_change();
clear_version_caches();
let new_version = installed_package_version("tachyon");
if (new_version == "")