Kill the runaway CPU process
- имя
kill-cpu-hog- образ
python:3.12-slim- таймаут
- 30с
проверка…
Задание
Kill the runaway CPU process
The host feels sluggish and top shows a Python process pinning a CPU core at
100%. Find that process and kill it.
Symptoms
$ top -b -n 1 -o %CPU | head -n 12
PID USER PR NI VIRT RES %CPU %MEM COMMAND
1234 root 20 0 12345 1234 99.7 0.5 python3 -c while True: pass
Required state
No process whose command line matches while True: pass may be running.
Why
The classic on-call "server is slow" scenario. Pratices ps, top, pgrep,
and kill. Don't kill the wrong PID.
Подсказки
Hints: kill the runaway process
- List everything:
ps -eo pid,pcpu,args --sort=-pcpu | head - Or target the pattern directly:
pgrep -f 'while True: pass' - Kill it:
pkill -f 'while True: pass'orkill <PID>frompgrep. - Verify:
pgrep -f 'while True: pass'should print nothing.
Терминал
Закрывается при остановке сессии.
Последние попытки
- Загрузка…
Разовый запуск (smoke-тест)
Атомарный цикл up → check → down. Полезно для CI; без предварительной подготовки состояния проверка завершится с ошибкой.