linux - Simulating a process stuck in a blocking system call -


i'm trying test behaviour hard reproduce in controlled environment.

use case: linux system; redhat el 5 or 6 (we're starting rhel 7 , systemd, it's out of scope).

there're situations need restart service. script use stopping service works quite well; sends sigterm process, designed handle it; if process doesn't handle sigterm within timeout (usually couple of minutes) script sends sigkill, waits couple minutes more.

the problem is: in (rare) situations, process doesn't exit after sigkill; happens when it's badly stuck on system call, possibly because of kernel-level issue (corrupt filesystem, or not-working nfs filesystem, or equally bad requiring manual intervention).

a bug arose when script didn't realize "old" process hadn't exited , started new process while old still running; we're fixing stronger locking system (so @ least new process doesn't start if old running), i find difficult test whole thing because haven't found way simulate hard-stuck process.

so, question is:

how can manually simulate process doesn't exit when sending sigkill it, privileged user?

if process stuck doing i/o, can simulate situation in way:

lvcreate -n lvtest -l 2g vgtest mkfs.ext3 -m0 /dev/vgtest/lvtest mount /dev/vgtest/lvtest /mnt dmsetup suspend /dev/vgtest/lvtest && dd if=/dev/zero of=/mnt/file.img bs=1m count=2048 & 

in way dd process stuck waiting io , ignore every signal, know signals aren't ignore in lastest kernel wheen processes waiting io on nfs filesystem.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -