Description

[Junos] Kill -6 <PID> will kill/restart the process and generate a core dump for it
 

Symptoms

When a process daemon is restarted with "kill -6", this command generates a core dump for the process which is an expected behaviour.
A snippet of the logs from lab node that outlines the steps:

labroot@jtac-mx104-r2606-re0> show version 
Hostname: jtac-mx104-r2606-re0
Model: mx104
Junos: 20.4R3-S2.6

labroot@jtac-mx104-r2606-re0> show system processes extensive | match craftd 
 2247 root   40  0 22916K 11636K select  0:05 0.00% craftd

{master}
labroot@jtac-mx104-r2606-re0> start shell 
root@jtac-mx104-r2606-re0% kill -6 2247
root@jtac-mx104-r2606-re0% cli
{master}
labroot@jtac-mx104-r2606-re0> show system processes extensive | match craftd 
25609 root   44  0 22912K 12016K select  0:00 1.32% craftd ----> process was restarted

{master}
labroot@jtac-mx104-r2606-re0> show system core-dumps 
/var/crash/*core*: No such file or directory
-rw-rw---- 1 root field  1033521 Oct 26 09:04 /var/tmp/craftd.core.0.gz ----- core-dump was also generated
/var/tmp/pics/*core*: No such file or directory
/var/crash/kernel.*: No such file or directory
/var/jails/rest-api/tmp/*core*: No such file or directory
/tftpboot/corefiles/*core*: No such file or directory
/jail/var/tmp/*core*: No such file or directory
total files: 1

{master}
labroot@jtac-mx104-r2606-re0> show log messages| match dump 
Oct 26 09:04:31.311 jtac-mx104-r2606-re0 init: craft-control (PID 2247) terminated by signal number 6. Core dumped!
Oct 26 09:04:31.311 jtac-mx104-r2606-re0 init: Dump Command: /bin/sh (PID 25608) started

 

Solution

Avoid running "kill -6 <PID>" and instead use "kill <PID>" or "kill -9 <PID>" which would restart the processes without generating a core-dump:

Example with "kill -9 <PID>":
{master}
labroot@jtac-mx104-r2606-re0> show system processes extensive | match craft 
25609 root   40  0 22916K 12020K select  0:01 0.00% craftd

{master}
labroot@jtac-mx104-r2606-re0> start shell user root 
Password:
root@jtac-mx104-r2606-re0% kill -9 25609
root@jtac-mx104-r2606-re0% cli
{master}
labroot@jtac-mx104-r2606-re0>

labroot@jtac-mx104-r2606-re0> show system core-dumps               
/var/crash/*core*: No such file or directory
/var/tmp/*core*: No such file or directory
/var/tmp/pics/*core*: No such file or directory
/var/crash/kernel.*: No such file or directory
/var/jails/rest-api/tmp/*core*: No such file or directory
/tftpboot/corefiles/*core*: No such file or directory
/jail/var/tmp/*core*: No such file or directory

Example with "kill <PID>":
labroot@jtac-mx104-r2606-re0> show system processes extensive | match craft 
28806 root   40  0 22916K 12024K select  0:00 0.00% craftd

labroot@jtac-mx104-r2606-re0> start shell user root
root@jtac-mx104-r2606-re0% kill 28806
root@jtac-mx104-r2606-re0% cli

labroot@jtac-mx104-r2606-re0> show system core-dumps 
/var/crash/*core*: No such file or directory
/var/tmp/*core*: No such file or directory
/var/tmp/pics/*core*: No such file or directory
/var/crash/kernel.*: No such file or directory
/var/jails/rest-api/tmp/*core*: No such file or directory
/tftpboot/corefiles/*core*: No such file or directory
/jail/var/tmp/*core*: No such file or directory
 

Or

Secondly,  we can use RE cli " request system process terminate process-id" to terminate the process. 


https://www.juniper.net/documentation/us/en/software/junos/cli-reference/topics/ref/command/request-system-process-terminate.html 

Modification History

New

Related Information

NA