All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Zombie user tasks
@ 2008-11-27 15:52 Mehmet Alphan Ulusoy
  2008-11-27 15:55 ` Gilles Chanteperdrix
  2008-11-27 19:39 ` Gilles Chanteperdrix
  0 siblings, 2 replies; 20+ messages in thread
From: Mehmet Alphan Ulusoy @ 2008-11-27 15:52 UTC (permalink / raw)
  To: xenomai

I have a problem where when I want to terminate a xenomai user space  
task, the task becomes a zombie and I can not re-run it since some of  
the resources (like mutexes) it uses are already there and can't be  
created again.

The scenario is as follows:

- A process running on the computer forks to create a child.
- The child executes the user space task using the system() call.  
(child does not return). I suppose userTask is the child of the child  
process now.
- After a while it attempts to terminate the task by calling "pkill  
-SIGTERM userTask"  using the system() call again.
- The task, not always but sooner or later -above steps are repeated  
for a number of times-, becomes a zombie.
- The user space task has a signal handler for SIGTERM and SIGINT signals.
- The signal handler is as follows:

void terminateGracefully(int sig)
{
     int err;
	    while (( err = rt_task_delete(&tid)) != 0)
	    {
	        printf("Error deleting task. Code %d.\n");
	    }
	    while (( err = rt_alarm_delete(&aid)) != 0)
	    {
	        printf("Error deleting alarm. Code %d.\n");
	    }
	    while (( err = rt_pipe_delete(&pidMon)) != 0)
	    {
	        printf("Error deleting pipe. Code %d.\n");
	    }
	    while (( err = close(sid)) != 0)
	    {
	        printf("Error deleting socket. Code %d.\n");
	    }
	}

- The signal handler is installed as follows:

signal(SIGTERM, terminateGracefully);
signal(SIGKILL, terminateGracefully);
signal(SIGINT, terminateGracefully);

- The child process which makes the system() call has a signal handler  
installed for SIGCHILD signal and calls wait() to collect their exit  
status.

signal(SIGCHLD, waitChild);

void waitChild(int sig)
{

     int status =0;

     wait(&status);

}

I've read somewhere that it's not safe to call printf() from a signal  
handler but even if I comment those lines out I can observe the same  
behavior. I don't see any error messages printed on the screen.

Is there a specific order to follow while deleting real-time entities?  
Is the system() call or "pkill -SIGTERM" the problem?

regards,

alphan


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2008-12-27 13:04 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-27 15:52 [Xenomai-help] Zombie user tasks Mehmet Alphan Ulusoy
2008-11-27 15:55 ` Gilles Chanteperdrix
2008-11-27 19:39 ` Gilles Chanteperdrix
2008-11-28 16:19   ` Mehmet Alphan Ulusoy
2008-11-28 16:23     ` Gilles Chanteperdrix
2008-11-28 16:29       ` Mehmet Alphan Ulusoy
2008-11-28 16:40         ` Gilles Chanteperdrix
2008-11-28 17:11         ` Gilles Chanteperdrix
2008-11-28 20:53           ` Alphan Ulusoy
2008-12-21 19:28           ` Alphan Ulusoy
2008-12-21 20:05             ` Alphan Ulusoy
2008-12-21 21:40               ` Alphan Ulusoy
2008-12-22  9:48                 ` Gilles Chanteperdrix
2008-12-22 11:32                   ` Mehmet Alphan Ulusoy
2008-12-22 13:03                     ` Gilles Chanteperdrix
2008-12-23  5:46                       ` Alphan Ulusoy
2008-12-23 10:53                         ` Gilles Chanteperdrix
2008-12-23 11:46                           ` Alphan Ulusoy
2008-12-23 11:50                             ` Gilles Chanteperdrix
     [not found]                           ` <9EB4E9E6-B9D4-433C-ABC9-FBBEF29DB0A3@domain.hid>
     [not found]                             ` <4950DB54.3000804@domain.hid>
     [not found]                               ` <C59B6CFD-F977-4130-B8D9-DEB86F055160@domain.hid>
     [not found]                                 ` <4950DE5E.6040700@domain.hid>
2008-12-27 13:04                                   ` Alphan Ulusoy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.