Bug 795968

Summary: kill -s 0 behavior undocumented and not consistent with other OSes
Product: Red Hat Enterprise Linux 5 Reporter: Ben Rogers <benson8>
Component: kernelAssignee: Red Hat Kernel Manager <kernel-mgr>
Status: CLOSED WONTFIX QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: low Docs Contact:
Priority: unspecified    
Version: 5.7CC: benson8
Target Milestone: rcFlags: pm-rhel: needinfo? (benson8)
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-02 13:03:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Ben Rogers 2012-02-21 21:56:26 UTC
Description of problem:

kill -0 [pid] (or kill -s 0 [pid]) does not seem to be documented in the man page for kill, but it is accepted on the command line.  Normally, the expectation would be something like:

     A signal number of 0 (kill -0 pid) checks the validity of a certain PID,
     to see if it exists.  An exit code of 0 means that the specified process
     exists.

You have a situation where you try and kill a process that no longer exists, and has been taken over in the process table by a thread that exists within another process.

Version-Release number of selected component (if applicable):

Linux host.name 2.6.18-274.18.1.el5 #1 SMP Fri Jan 20 15:11:18 EST 2012 x86_64 x86_64 x86_64 GNU/Linux

How reproducible:

1. It is reproducible with a process that is multi-threaded (e.g., a JVM-based process).

Steps to Reproduce:
1.  Have a multi-threaded process running, e.g. (from ps -eLf):

nonroot  24881     1 24881  0  124 13:15 ?        00:00:00 /usr/bin/java -server
 -D [etc]
nonroot  24881     1 24883  1  124 13:15 ?        00:00:33 /usr/bin/java -server
 -D [etc]

Note that 'ps waux | grep 24883' should not turn up any results for a process running under that ID.

2. Issue a kill -0 (or kill -s 0):

kill -s 0 24883 && echo pid exists

  
Actual results:

pid exists

Expected results:

Should not print the string, since the process doesn't exist (although the thread does).

Additional info:

This behavior from kill is relied upon to take a process from a PID file to test and see if it still exists in the process table, so the inconsistency is leading to unexpected results under the conditions described.

Comment 1 RHEL Program Management 2014-03-07 12:40:29 UTC
This bug/component is not included in scope for RHEL-5.11.0 which is the last RHEL5 minor release. This Bugzilla will soon be CLOSED as WONTFIX (at the end of RHEL5.11 development phase (Apr 22, 2014)). Please contact your account manager or support representative in case you need to escalate this bug.

Comment 2 RHEL Program Management 2014-06-02 13:03:30 UTC
Thank you for submitting this request for inclusion in Red Hat Enterprise Linux 5. We've carefully evaluated the request, but are unable to include it in RHEL5 stream. If the issue is critical for your business, please provide additional business justification through the appropriate support channels (https://access.redhat.com/site/support).