I'm testing some functionality to monitor processes and I need to emulate long core dump with determined "delay" (for example I need to make a process to "dump core" for 30 seconds). I'm noticed that process that dumping a core is in uninterruptible sleep, so it can't be killed with SIGKILL, but when I'm trying to emulate this behavior using pipe commands that receives coredump I can easily kill such process. So is there some way to make process to get into uninterruptible sleep (with such status in ps) and make it ignore the SIGKILL?
Most proper way is to use freezer cgroup. It puts process to uninterruptible sleep in case of FROZEN cgroup state.
# mkdir /sys/fs/cgroup/freezer
# mount -t cgroup -ofreezer freezer /sys/fs/cgroup/freezer
# mkdir /sys/fs/cgroup/freezer/frozen
# echo FROZEN > /sys/fs/cgroup/freezer/frozen/freezer.state
# echo `pidof you_process` > /sys/fs/cgroup/freezer/frozen/tasks
To put again to interruptible sleep, just change cgroup state to THAWED.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With