How do I confirm that the 'kernel.hung_task_panic' parameter works?
Environment
- Red Hat Enterprise Linux 5, 6, 7, 8, 9
- Kernel
- Kexec-tools
Issue
- After enabling "kernel.hung_task_panic", how do I confirm that it will work?
- System didn't generate vmcore after encountering hung_task_timeout_secs messages, even when the hung_task_panic was set.
- How do I simulate hung task to test it?
Resolution
Assuming kdump is configured and hung_task_panic is enabled, there can be a couple of ways to simulate hung tasks.
A)
- Open two console. One is Console A, the other is Console B.
- In Console A, run following command:
# while true; do dd if=/dev/zero of=/tmp/test_dd bs=1024 count=100; done
- In Console B, run following command, where 'mount point' is the mount point for the filesystem which the
ddcommand is writing to:
# fsfreeze -f <mount point>
- After a while, system will panic.
B)
- Write a C program deadlock.c with following contents:
int main(void)
{
vfork();
sleep(50);
return 0;
}
- Reduce the default value of hung_task_timeout_secs parameter from 120 to 20:
# echo 20 > /proc/sys/kernel/hung_task_timeout_secs
- Compile and run the deadlock.c program:
# gcc -o deadlock deadlock.c
# ./deadlock
- After 20 seconds or so system should crash and vmcore should be generated.
SBR
Product(s)
Components
Category
Tags
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.