mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-05-03 23:45:59 +00:00
refactor(node-heap): raise auto cap to 12GB and simplify OOM hint
- Increase setup_nodejs auto heap clamp from 4GB to 12GB for heavy frontend builds - Keep lower bound at 1GB and preserve user override precedence - Simplify error_handler Node OOM output to a single concise hint - Align error_handler heap suggestion clamp to 12GB
This commit is contained in:
@@ -347,18 +347,14 @@ error_handler() {
|
|||||||
|
|
||||||
if [[ -z "$heap_hint_mb" ]] || ((heap_hint_mb < 1024)); then
|
if [[ -z "$heap_hint_mb" ]] || ((heap_hint_mb < 1024)); then
|
||||||
heap_hint_mb=1024
|
heap_hint_mb=1024
|
||||||
elif ((heap_hint_mb > 4096)); then
|
elif ((heap_hint_mb > 12288)); then
|
||||||
heap_hint_mb=4096
|
heap_hint_mb=12288
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if declare -f msg_warn >/dev/null 2>&1; then
|
if declare -f msg_warn >/dev/null 2>&1; then
|
||||||
msg_warn "Detected possible Node.js heap OOM during build."
|
msg_warn "Possible Node.js heap OOM. Try: export NODE_OPTIONS=\"--max-old-space-size=${heap_hint_mb}\" and rerun the build."
|
||||||
msg_warn "Try: export NODE_OPTIONS=\"--max-old-space-size=${heap_hint_mb}\" before npm/pnpm/yarn build."
|
|
||||||
msg_warn "Recommendation: call setup_nodejs before build steps so heap defaults are applied automatically."
|
|
||||||
else
|
else
|
||||||
echo -e "${YW}Detected possible Node.js heap OOM during build.${CL}"
|
echo -e "${YW}Possible Node.js heap OOM. Try: export NODE_OPTIONS=\"--max-old-space-size=${heap_hint_mb}\" and rerun the build.${CL}"
|
||||||
echo -e "${YW}Try: export NODE_OPTIONS=\"--max-old-space-size=${heap_hint_mb}\" before npm/pnpm/yarn build.${CL}"
|
|
||||||
echo -e "${YW}Recommendation: call setup_nodejs before build steps so heap defaults are applied automatically.${CL}"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -6426,7 +6426,7 @@ function setup_nodejs() {
|
|||||||
# 2) NODE_MAX_OLD_SPACE_SIZE (explicit MB override)
|
# 2) NODE_MAX_OLD_SPACE_SIZE (explicit MB override)
|
||||||
# 3) var_ram (LXC memory setting, MB)
|
# 3) var_ram (LXC memory setting, MB)
|
||||||
# 4) /proc/meminfo (runtime memory detection)
|
# 4) /proc/meminfo (runtime memory detection)
|
||||||
# Auto value is clamped to 1024..4096 MB.
|
# Auto value is clamped to 1024..12288 MB.
|
||||||
if [[ -z "${NODE_OPTIONS:-}" ]]; then
|
if [[ -z "${NODE_OPTIONS:-}" ]]; then
|
||||||
local node_heap_mb=""
|
local node_heap_mb=""
|
||||||
|
|
||||||
@@ -6445,8 +6445,8 @@ function setup_nodejs() {
|
|||||||
|
|
||||||
if [[ -z "$node_heap_mb" ]] || ((node_heap_mb < 1024)); then
|
if [[ -z "$node_heap_mb" ]] || ((node_heap_mb < 1024)); then
|
||||||
node_heap_mb=1024
|
node_heap_mb=1024
|
||||||
elif ((node_heap_mb > 4096)); then
|
elif ((node_heap_mb > 12288)); then
|
||||||
node_heap_mb=4096
|
node_heap_mb=12288
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export NODE_OPTIONS="--max-old-space-size=${node_heap_mb}"
|
export NODE_OPTIONS="--max-old-space-size=${node_heap_mb}"
|
||||||
|
|||||||
Reference in New Issue
Block a user