LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-01-2007, 09:08 AM   #1
guitar_199
LQ Newbie
 
Registered: Jul 2006
Location: Deer Park, Texas
Distribution: Slackware 11.0
Posts: 16

Rep: Reputation: 0
Question on catching SIGCHLD in 2.6


This is probably something simple but I can't seem to figure it out.

I am helping an applications group that has been porting a program from 2.4 to 2.6. All that they know is that it revolves around a child process dying and the SIGCHLD gets sent to the wrong thread and sticks there.

While looking at this problem, I have modelled a test that starts, spins off 4 threads, forks/execs a second process that brings up four threads. I have written the first process capable of establishing signal handling on ANY one of the threads at a time. The second app, the threads come up, calculate a random sleep time from 10 to 25 seconds, and when each wakes up it terminates, when the last one terminates, the 2nd process dies.(They wanted to see it done this way to observe thread death and process death!)

Anyway, here is the SIMPLE explanation of what I see.

If I tell the first process to handle signals on ANY of the SPUN off threads, everything works fine! When the last thread dies, the second process croaks, and I see the SIGCHLD back in the signal handling thread in the first process. I then hit CTRL-C(SIGINT, which I am also watching for...) and the first process dies.

IF I tell the program to handle signals on the initial thread, I can see it set up the same mask, I can see it pass the exact same mask to sigwait(), and yet, when the second process dies, I see nothing in the signal handling in the first process. Nothing. The funny thing is, when I hit the CTRL-C the initial thread sees it, wakes up and announces it, and then dies like I tell it to.

It seems as though, for some reason, the initial thread is ignoring the SIGCHLD when I have not told it to but it is NOT ignored when I set up signal handling with the same procedure on a thread that I spun off.

Can anyone point me in a direction just BEFORE applying a swift kick? That way the momentum might help me get where I need to be!!!

Thanks!
Bob Ruth
 
Old 08-01-2007, 10:46 AM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
I'm thinking that it might be easier to understand the poetry than the prose which you've given us. (grin)

Since this is a relatively short test program, bordering on the tiny, you wouldn't consider posting the test program, would you?

You probably already know this, but to enhance the readability of your code, put it between CODE markers. To do so:
  1. Click the Go Advanced button at the bottom of the editing window.
  2. Within the new editing window, highlight the code you've inserted.
  3. Click the # icon at the top of the new editing window.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kernal message :application bug: app_name(20791) has SIGCHLD set to SIG_IGN but ca... ayeletst Linux - General 1 12-13-2005 07:56 AM
kernal message :application bug: app_name(20791) has SIGCHLD set to SIG_IGN but ca... ayeletst Linux - General 1 12-13-2005 02:23 AM
Sigchld ckamheng Programming 1 10-09-2005 11:11 PM
Question : catching cores Saeven Linux - General 2 06-13-2002 04:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration