星期二, 5月 29, 2018

How to simulate process hang in Linux

To simulate the process hang, you can use the kill command with SIGSTOP signal

for example:

kill -SIGSTOP pid

My  case:

I tried to recreate the MQ client process hang and didn't reply the heartbeat packet to qmgr to see we can get what kind of error in qmgr error log.
.
step 1: start MQ client

#./amqsputc LQ1 QM1

step 2: find out the pid

#ps -ef|grep amqsputc

step 3: send SIGSTOP to the pid
#kill -SIGSTOP pid

check the qmgr error log and I can find out the following error message
-----------------------------------------------------
AMQ9271: Channel 'svrconn' timed out.

EXPLANATION:
A timeout occurred while waiting to receive from the other end of channel
'svrconn'. The address of the remote end of the connection was
'192.168.xxx.xxx'.
ACTION:
The return code from the select() [TIMEOUT] 35 seconds call was 4 (X'4').
Record these values and tell the systems administrator.
-------------------------------------------------------

In this case, the qmgr will close the connection due to no response from MQ client after heartbeat interval. The MQ client will report 2009 error (connection broken, reset by peer) after come back from hang issue.

To continue the process, you can use kill with SIGCONT signal.

沒有留言: