From dc3b7a2720761d69fe62e8f04022ff18ae4b9e34 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 26 Apr 2025 19:06:32 +0000 Subject: [PATCH] reduce `--th-ram-max` floor; helps avoid oom in a vm with 512 MiB ram --- copyparty/__main__.py | 2 +- copyparty/util.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 0dbab9f2..20400540 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1352,7 +1352,7 @@ def add_admin(ap): def add_thumbnail(ap): th_ram = (RAM_AVAIL or RAM_TOTAL or 9) * 0.6 - th_ram = int(max(min(th_ram, 6), 1) * 10) / 10 + th_ram = int(max(min(th_ram, 6), 0.3) * 10) / 10 ap2 = ap.add_argument_group('thumbnail options') ap2.add_argument("--no-thumb", action="store_true", help="disable all thumbnails (volflag=dthumb)") ap2.add_argument("--no-vthumb", action="store_true", help="disable video thumbnails (volflag=dvthumb)") diff --git a/copyparty/util.py b/copyparty/util.py index 7849f103..2e204ba1 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -472,6 +472,8 @@ FN_EMB = set([".prologue.html", ".epilogue.html", "readme.md", "preadme.md"]) def read_ram() -> tuple[float, float]: + # NOTE: apparently no need to consider /sys/fs/cgroup/memory.max + # (cgroups2) since the limit is synced to /proc/meminfo a = b = 0 try: with open("/proc/meminfo", "rb", 0x10000) as f: