diff --git a/history/2026-05-04-amd-iommu-freeze.md b/history/2026-05-04-amd-iommu-freeze.md new file mode 100644 index 0000000..ae6af46 --- /dev/null +++ b/history/2026-05-04-amd-iommu-freeze.md @@ -0,0 +1,89 @@ +--- +date: 2026-05-04 +topic: incus-kr2 AMD-Vi (IOMMU) Completion-Wait timeout 호스트 부분 hang +areas: + - infra/compute/hosts/incus-kr2.md + - infra/compute/infra-hosts.md +tags: [history, incident, kr2, amd, iommu, freeze] +--- + +## 배경 + +incus-kr2가 약 2주 간격으로 호스트 freeze 재발. 이전 두 사건([[2026-04-04-usb-25g-hang]] USB autosuspend, 2026-04-19 OOM)은 각각 `usbcore.autosuspend=-1`과 `kubelet system-reserved=8Gi`로 막은 상태였으나 또 다른 원인으로 hang. Tapo 스마트플러그를 kr2에 연결하여 강제 리부팅 가능하도록 사전 대비된 상태. + +## 인시던트 + +**시각**: 2026-05-04 12:36 KST (호스트 시계 PDT로 잘못 설정되어 있어 `May 03 20:36` 기록 — KST 12:36) +**복구**: 2026-05-04 12:50 KST 사용자가 Tapo로 강제 리부팅 +**다운타임**: 약 2시간 13분 (10:37 NotReady → 12:50 reboot) +**영향**: leewell.com 포함 inbest 7 컨테이너 응답 일부만 동작 (LXC 커널 namespace로 nginx는 살아 외부에 nginx 404 반환), K3s 워크로드 일부 Terminating (argocd redis, db pgpool, external-secrets, longhorn csi) + +## 증상 vs 가설 부정 매트릭스 + +| 가설 | 증거 | 결론 | +|------|------|------| +| NIC (USB r8152 autosuspend) | carrier=1, 다른 노드에서 wget 응답 정상, 평소 트래픽 14~70 B/s | ❌ | +| NFS hard mount D-state | `procs_blocked=0` 8:43 KST까지 | ❌ | +| OOM | MemoryPressure=False, MemAvailable 23 GiB | ❌ | +| 디스크 hardware | SMART Critical=0, Errors=0, Percentage Used 1% | ❌ | +| **AMD IOMMU Completion-Wait** | dmesg `AMD-Vi: Completion-Wait loop timed out` (12:36, 12:46 x2) → 그 직후 hang | ✅ | + +## 진단 핵심 + +- ICMP/메모리 매핑된 프로세스(node-exporter, nginx)는 응답 유지 +- containerd, incus 데몬, sshd 새 세션 fork만 동시에 hang +- kubelet 마지막 이벤트: `failed to read podLogsDirectory "/var/log/pods": readdirent: input/output error` (91회 반복) +- node-exporter의 `up=1`은 끊긴 적 없음 — 헤임달 1차 진단 "kr2 호스트 자체 다운 2일 2시간"은 시간대/로그 해석 오류, 실제는 당일 약 2시간 13분 +- 이 패턴은 IOMMU가 stall되어 DMA 통하는 디바이스(NVMe, USB 컨트롤러)가 응답 못 하지만 커널 자체와 메모리 매핑된 프로세스는 동작하는 부분 hang의 전형 + +## 직접 검증 데이터 (메트릭) + +**freeze 직전 (08:31~08:44 KST 호스트 시계 기준 — 실제 KST는 +9h가 아니라 호스트 시계가 PDT라서 변환 필요. K3s NotReady transition 기준 10:37:43 KST)**: +- load1 = 2.22 (정상) +- MemAvailable = 23.13 GiB +- `procs_blocked` = 0 +- `nvme0n1` io_time fraction = 2%, write 34 IOPS +- NVMe 온도 41~42 °C + +→ 점진적 자원 고갈 흔적 0. "갑자기 정지" 패턴 = 펌웨어/IOMMU level hang. + +## 재부팅 후 검증 + +``` +[ 0.641598] iommu: Default domain type: Passthrough (set via kernel command line) +``` + +이전 부팅에서 부팅 후 24분 만에 첫 Completion-Wait timeout 발생, 이후 누적되며 hang. `iommu=pt` 적용 부팅 후 동일 시점 검증 필요. + +## 조치 + +GRUB cmdline에 `iommu=pt` 추가: + +```bash +sudo cp /etc/default/grub /etc/default/grub.bak.20260504-iommu +sudo sed -i -E 's/^(GRUB_CMDLINE_LINUX_DEFAULT="[^"]*)(")/\1 iommu=pt\2/' /etc/default/grub +sudo update-grub +sudo systemctl reboot +``` + +**적용 후 cmdline**: +``` +ro usbcore.autosuspend=-1 quiet iommu=pt +``` + +부수 조치: +- 호스트 시간대 `America/Los_Angeles` → `Asia/Seoul` 수정 (`timedatectl set-timezone Asia/Seoul`). 이 잘못된 timezone이 헤임달 1차 진단의 "2일 2시간" 오판 원인. + +## 교훈 + +- AMD Ryzen 미니 PC 베어메탈은 IOMMU passthrough 기본 적용 권장. 직전 부팅 24분 만에 첫 timeout이 떴다는 건 시간 문제로 hang 보장된 상태. +- IOMMU hang은 OOM/디스크/NIC와 다르게 메트릭에 점진적 흔적 안 남고 갑자기 정지. `node_procs_blocked` 0으로 끝나도 안전 신호 아님. +- `dmesg | grep AMD-Vi` 가 새 호스트 도입 시 표준 점검 항목. +- 호스트 timezone 통일 — 한국 인프라는 `Asia/Seoul`로 강제. 잘못된 timezone은 인시던트 분석 시 시간대 변환 오류로 잘못된 결론 유도. +- **헤임달 1차 진단 "kr2 호스트 자체 다운"은 표면 ssh/incus refused만 보고 결론. 메트릭 시계열·외부 응답까지 교차 검증 안 함.** 다음에 비슷한 진단 시 헤임달이 node-exporter `up`, 외부 nginx 응답 등을 같이 보도록 운영 규칙 보강 검토. + +## 관련 문서 + +- [[infra/compute/hosts/incus-kr2|incus-kr2]] +- [[2026-04-04-usb-25g-hang]] — 직전 freeze (USB) +- [[infra/compute/infra-hosts]] diff --git a/history/_index.md b/history/_index.md index 4a8b53e..d8c2bd0 100644 --- a/history/_index.md +++ b/history/_index.md @@ -1,6 +1,6 @@ --- title: history 인덱스 -updated: 2026-04-26 +updated: 2026-05-04 tags: [moc, history] --- @@ -34,3 +34,4 @@ tags: [moc, history] | [[2026-04-25-anomaly-detect-removal]] | anomaly-detect 폐기 (오탐 다수, 컨테이너 포함 완전 제거) | | [[2026-04-25-netbis-npm-vector-msg-rewrite]] | NPM Vector `_msg` 재합성 (proxy_v2 → nginx combined) — child-nginx-logs unparsed 84% 해결 | | [[2026-04-26-bouncer-consolidation]] | CrowdSec bouncer 단일화 (netbis-cf-firewall만 유지, 나머지 3종 + Edge Script 64811 + Turnstile 위젯 6개 폐기) | +| [[2026-05-04-amd-iommu-freeze]] | incus-kr2 AMD-Vi (IOMMU) Completion-Wait timeout 호스트 부분 hang — `iommu=pt` 적용 | diff --git a/infra/compute/hosts/incus-kr2.md b/infra/compute/hosts/incus-kr2.md new file mode 100644 index 0000000..1503713 --- /dev/null +++ b/infra/compute/hosts/incus-kr2.md @@ -0,0 +1,78 @@ +--- +title: incus-kr2 +updated: 2026-05-04 +tags: [infra, host, incus, k3s, seoul, amd, iommu] +type: host +host_kind: server +location: seoul +provider: self-hosted +status: active +ssh_host: incus-kr2 +tailscale_ip: 100.119.109.41 +lan_ip: 192.168.9.135 +lan_ip_2_5g: 192.168.205.135 +os: Debian 13 (trixie) +kernel: 6.12.85+deb13-amd64 +cpu_model: AMD Ryzen 9 6900HX +cpu_cores: 16 +ram_gb: 30 +k3s_role: control-plane +critical: true +monthly_cost_usd: 0 +chassis: Bosgame EffiZen Series (mini PC) +--- + +## 역할 + +Incus + K3s control-plane 호스트 (서울존). Mini PC 폼팩터, AMD Ryzen 9 6900HX. K3s control-plane 2 중 하나, Incus 프로젝트 `default` + `inbest`. inbest 프로젝트가 leewell.com 등 7 컨테이너(cloudflared/nginx/php5/php8/mariadb10/phpmyadmin/sftp) 호스팅 — kr2 단일 장애 시 leewell.com 포함 inbest 서비스 전체 다운. + +## 네트워크 + +- 1G LAN `192.168.9.135` (eno1) — Tailscale 진입 +- 2.5G LAN `192.168.205.135` (USB r8152, `enx803f5dd34c9f`) — 백업/대용량 전송용 (실 사용량 14~70 B/s 수준으로 거의 idle, [[infra-hosts]] 참조) +- Tailscale `100.119.109.41` + +## 전원/원격제어 + +- Tapo 스마트플러그 연결 → 강제 리부팅 가능 (호스트 hang 시 유일한 OOB 수단) +- iLO/IPMI 미장착 (mini PC 폼팩터) + +## 알려진 hang 패턴 — AMD-Vi (IOMMU) Completion-Wait Timeout + +호스트 freeze가 반복 발생한 근본 원인 (2026-05-04 확정, [[2026-05-04-amd-iommu-freeze]]). + +**증상**: +- ICMP/이미 매핑된 프로세스(node-exporter, LXC 컨테이너 nginx)는 응답 유지 +- containerd, incus 데몬, sshd 새 세션 fork만 동시에 hang +- kubelet `container runtime is down`, `/var/log/pods readdirent: input/output error` +- procs_blocked 0, MemoryPressure False — 자원 고갈 아님 + +**원인**: AMD Ryzen 6900HX IOMMU(AMD-Vi) Completion-Wait queue stall. `dmesg`에 `AMD-Vi: Completion-Wait loop timed out` 반복 후 누적되어 DMA 의존 디바이스(NVMe, USB 컨트롤러 등)가 stall. + +**조치 (2026-05-04 적용)**: GRUB cmdline `iommu=pt` 추가 → IOMMU passthrough 모드. dmesg `iommu: Default domain type: Passthrough` 확인. + +**과거 freeze 이력 비교**: +| 일자 | 원인 | 조치 | +|------|------|------| +| 2026-04-04 | USB 2.5GbE r8152 autosuspend hang ([[2026-04-04-usb-25g-hang]]) | `usbcore.autosuspend=-1` + udev rule | +| 2026-04-19 | OOM freeze (RAM 30 GiB 과적) | `kubelet system-reserved=8Gi` | +| 2026-05-04 | AMD-Vi IOMMU Completion-Wait timeout | `iommu=pt` | + +## kr2 전용 K3s 설정 + +- `kubelet system-reserved=memory=8Gi`, `eviction-hard=memory.available<2Gi` (2026-04-19 OOM 대응, RAM 30 GiB로 K3s + Incus 공존) +- 변경 금지 — 제거 시 OOM 재현 위험 + +## GRUB cmdline + +``` +ro usbcore.autosuspend=-1 quiet iommu=pt +``` + +- `usbcore.autosuspend=-1` — USB r8152 절전 hang 차단 (2026-04-04) +- `iommu=pt` — AMD-Vi Completion-Wait timeout 차단 (2026-05-04) + +## 디스크 + +- `/dev/nvme0n1` — root + 데이터, ext4 937 GiB (사용 18%) +- SMART 깨끗 (Critical Warning 0, Media Errors 0, Percentage Used 1%) diff --git a/infra/compute/infra-hosts.md b/infra/compute/infra-hosts.md index d5806b4..35ad4e5 100644 --- a/infra/compute/infra-hosts.md +++ b/infra/compute/infra-hosts.md @@ -1,6 +1,6 @@ --- title: 인프라 호스트 및 네트워크 -updated: 2026-04-26 bouncer 단일화 — jp1 default 20→19 (cs-cf-worker-bouncer 폐기) + hp2 default 5→4 (anomaly-detect 폐기 2026-04-25) +updated: 2026-05-04 incus-kr2 GRUB `iommu=pt` 적용 (AMD-Vi Completion-Wait timeout 차단) tags: [infra, network, kr-zone, openwrt] --- @@ -15,7 +15,7 @@ tags: [infra, network, kr-zone, openwrt] | apisix-osaka | 100.108.39.107 | [[apisix]] API Gateway (오사카) | SSH 직접 접속 | | incus-jp1 | 100.109.123.1 | Incus 호스트 (도쿄) | agents, db, default, monitoring 프로젝트 | | incus-kr1 | 100.84.111.28 | Incus+K3s 호스트 (서울) | GTX 1080 Ti, K3s control-plane (LAN 192.168.9.214), default 프로젝트 | -| incus-kr2 | 100.119.109.41 | Incus+K3s 호스트 (서울) | K3s control-plane (LAN 192.168.9.135), default, inbest 프로젝트 | +| incus-kr2 | 100.119.109.41 | [[incus-kr2\|Incus+K3s 호스트 (서울)]] | **AMD Ryzen 9 6900HX, 30 GiB RAM, Bosgame mini PC**, K3s control-plane (LAN 192.168.9.135), default, inbest 프로젝트, GRUB `iommu=pt` (AMD-Vi hang 차단, [[2026-05-04-amd-iommu-freeze]]), Tapo 스마트플러그 OOB | | incus-hp1 | — | Incus+K3s 호스트 (서울) | **HP ProLiant DL360p Gen8** 베어메탈, Xeon E5-2670 32코어, 188GB RAM, K3s worker/k3s-agent (LAN 192.168.9.227), 1GbE only (2.5G 미탑재), Tailscale 미설치, default 프로젝트, 2026-04-16 신규 | | incus-hp2 | 100.100.52.34 | Incus+K3s 호스트 (서울) | **HP ProLiant DL360p Gen8** 베어메탈, Xeon E5-2670 32코어, 188GB RAM, 커널 6.12.74+deb13+1 (2026-04-14 업데이트), K3s worker/k3s-agent (LAN 192.168.9.134), default, inbest 프로젝트 | | openwrt-gw | 100.66.60.66 | **OpenWrt 라우터 (서울, critical)** | HAProxy: 80/443 → MetalLB Traefik(192.168.9.53:80/443), 9080/9443 → MetalLB APISIX(192.168.9.50:80/443), **5432 → Patroni PostgreSQL Leader (K3s kine 데이터스토어 진입점, [[postgresql-ha]] 참조)**. 이 노드 다운 시 K3s API/HTTP 진입 모두 중단 |