처음에는 여러 프로세스를 생성하고 종료하여 lxml 메모리 누수를 방지하려고 시도했지만 실패했습니다.
그래서 새로운 아이디어를 시도하기 전에 서비스 파일에 를 설정했습니다 OOMPolicy=stop
.MemoryMax=2G
내 의도는 Podman 통계의 메모리 사용량이 2G에 도달하면 systemd의 OOM-killer가 (커널에서 SIGKILL 대신) 중지를 보내는 것입니다. 그래서 다시 시작됩니다.
그러나 메모리 사용량 podman stats
은 164.9MB
이지만 systemctl status
결과는 입니다 Memory: 756.0K (high: 1.8G max: 2.0G available: 1.8G)
. (높은 부분은 무시하셔도 됩니다. 방금 시도해봤습니다 --runtime
.)
물론 실험을 통해 뭔가를 보여줄 수 있겠지만, 메모리에 대한 설명을 듣고 싶습니다. 유닉스에는 제가 아직 이해하지 못하는 동작에 대한 이유가 있을 것이기 때문입니다.
$podman stats
ID NAME CPU % MEM USAGE / LIMIT MEM % NET IO BLOCK IO PIDS CPU TIME AVG CPU %
254d65607347 memory_leaking_lxml_container 0.09% 164.9MB / 33.29GB 0.50% 40.84MB / 2.479MB 0B / 0B 14 21.501493s 0.84%
$systemctl status --user container-memory_leaking_lxml_container.service
● container-memory_leaking_lxml_container.service - Podman container-memory_leaking_lxml_container.service
Loaded: loaded (/home/shelf/.config/systemd/user/container-memory_leaking_lxml_container.service; enabled; preset: disabled)
Drop-In: /run/user/1000/systemd/user.control/container-memory_leaking_lxml_container.service.d
└─50-MemoryHigh.conf
Active: active (running) since Thu 2023-10-26 02:43:46 KST; 13s ago
Docs: man:podman-generate-systemd(1)
Main PID: 10403 (conmon)
Tasks: 1 (limit: 202744)
Memory: 756.0K (high: 1.8G max: 2.0G available: 1.8G)
CPU: 88ms
CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/container-memory_leaking_lxml_container.service
└─10403 /usr/bin/conmon --api-version 1 -c 6a4a037a7cca7641188ea145446e8fac2ba6a76ccf81ebce7a9d52cb80e31265 -u 6a4a037a7cca7641188ea145446e8fac2ba6a76ccf81ebce7a9d52cb80e31265 -r /usr/bin/crun -b /home/shelf/.local/share/cont>
또 다른 경우는 '42.84MB'와 '80.9M'이다.
af8cfa352332 taskwarrior-webui 0.01% 42.84MB / 12.26GB 0.35% 2.42kB / 430B 0B / 0B 23 959.476ms 0.01%
[shelf@localhost ~]$ systemctl --user status container-taskwarrior-webui.service
● container-taskwarrior-webui.service - Podman container-287516d806e5dec732bb2152568304950343e98c75cd05f8ade36826a2d292e2.service
Loaded: loaded (/home/shelf/.config/systemd/user/container-taskwarrior-webui.service; enabled; preset: disabled)
Active: active (running) since Thu 2023-10-26 01:19:24 KST; 2h 19min ago
Docs: man:podman-generate-systemd(1)
Main PID: 1801 (conmon)
Tasks: 16 (limit: 74601)
Memory: 80.9M
CPU: 695ms
CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/container-taskwarrior-webui.service
├─1735 /usr/bin/slirp4netns --disable-host-loopback --mtu=65520 --enable-sandbox --enable-seccomp --enable-ipv6 -c -e 3 -r 4 --netns-type=path /run/user/1000/netns/netns-cb5acc65-4f8a-650e-6ae6-68e4fc909e11 tap0
├─1738 rootlessport
├─1745 rootlessport-child
├─1777 /usr/bin/fuse-overlayfs -o "lowerdir=/home/shelf/.local/share/containers/storage/overlay/l/24YP66TL5NQBZOG6ZSFAGPT42L:/home/shelf/.local/share/containers/storage/overlay/l/6OIWR3J24EEIAHQS7UBWPF6XQ4:/home>
└─1801 /usr/bin/conmon --api-version 1 -c af8cfa352332489ffaa29c82efd7ecf6e6dbb0d90705be6b559203a7f45bb8a0 -u af8cfa352332489ffaa29c82efd7ecf6e6dbb0d90705be6b559203a7f45bb8a0 -r /usr/bin/crun -b /home/shelf/.local/shar>
Oct 26 01:19:23 localhost.localdomain podman[1636]: 2023-10-26 01:19:23.144002301 +0900 KST m=+1.152343622 container create af8cfa352332489ffaa29c82efd7ecf6e6dbb0d90705be6b559203a7f45bb8a0 (image=docker.io/dcsunset/taskwarrior-webui:lates>
Oct 26 01:19:24 localhost.localdomain podman[1636]: 2023-10-26 01:19:24.368842932 +0900 KST m=+2.377184246 container init af8cfa352332489ffaa29c82efd7ecf6e6dbb0d90705be6b559203a7f45bb8a0 (image=docker.io/dcsunset/taskwarrior-webui:latest,>
Oct 26 01:19:24 localhost.localdomain systemd[835]: Started Podman container-287516d806e5dec732bb2152568304950343e98c75cd05f8ade36826a2d292e2.service.
Oct 26 01:19:24 localhost.localdomain podman[1636]: 2023-10-26 01:19:24.649773078 +0900 KST m=+2.658114401 container start af8cfa352332489ffaa29c82efd7ecf6e6dbb0d90705be6b559203a7f45bb8a0 (image=docker.io/dcsunset/taskwarrior-webui:latest>
Oct 26 01:19:24 localhost.localdomain podman[1636]: af8cfa352332489ffaa29c82efd7ecf6e6dbb0d90705be6b559203a7f45bb8a0
Oct 26 01:19:46 localhost.localdomain taskwarrior-webui[1801]:
Oct 26 01:19:46 localhost.localdomain taskwarrior-webui[1801]: > [email protected] start
Oct 26 01:19:46 localhost.localdomain taskwarrior-webui[1801]: > node ./dist/app.js
Oct 26 01:19:46 localhost.localdomain taskwarrior-webui[1801]:
Oct 26 01:19:50 localhost.localdomain taskwarrior-webui[1801]: Server listening on http://0.0.0.0:3000