Bug 111136 (IT_57659)

Summary: Processes forked from Python subthreads block signals
Product: Red Hat Enterprise Linux 3 Reporter: Göran Uddeborg <goeran>
Component: pythonAssignee: Mihai Ibanescu <mihai.ibanescu>
Status: CLOSED UPSTREAM QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: tao
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-04-05 20:35:32 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Python program illustrating the behaviour. none

Description Göran Uddeborg 2003-11-28 12:14:18 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030922

Description of problem:
When a Python program starts a new thread, and this new thread forks,
the forked process ingores signals.  It will not terminate, or dump
core if that would be applicable, when it receives a signal.

Version-Release number of selected component (if applicable):
python-2.2.3-5 (kernel-2.4.21-4.EL glibc-2.3.2-95.6)

How reproducible:
Always

Steps to Reproduce:
1.Run the attached test case.

Actual Results:  After execution of the parent program threads
finishes, there is still a python process around, continuing to sleep.

Expected Results:  The child process should have died and produced a core.

Additional info:

Apparently, Python subthreads blocks signals.  /proc/*/status for
subthreads includes the line

SigBlk: ffffffff7ffbfeff

The Python documentation says one should only install signal handlers
in the main thread, and only the main thread will recieve signals.  So
this is probably in order.  But when the subthread forks, the new
process inherits this signal mask, which seems to be incorrect
behaviour.  I would assume, if Python sets this signal mask for
threads, it should also reset it again after a fork.

At first this appears to be a Python bug, and maybe I should report it
upstreams.  But I'm not sure if it in some way interacts with the NPTL
fixes of Red Hat, I thought it was safer to start here.

Comment 1 Göran Uddeborg 2003-11-28 12:17:27 UTC
Created attachment 96234 [details]
Python program illustrating the behaviour.

Comment 2 Göran Uddeborg 2003-12-03 16:58:17 UTC
After some additional investigations, we have reproduced this on Sun
Solaris too.  I assume this means it is a Python rather than Red Hat
bug, and I've reported it to their bug system:
https://sourceforge.net/tracker/?func=detail&aid=853411&group_id=5470&atid=105470

Comment 3 Mihai Ibanescu 2003-12-03 16:59:35 UTC
Thanks for your help, I was going to try to reproduce it but didn't
get around to do it.