semaphores and PID

This is a discussion on semaphores and PID within the Linux Administration forums, part of the Linux Forums category; Hello, I have a problem with a semaphores. It is look like some processes use semaphores, but after they die, ...


Go Back   Usenet Forums > Linux Forums > Linux Administration

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-17-2003
Lovro VREŠ
 
Posts: n/a
Default semaphores and PID

Hello,

I have a problem with a semaphores. It is look like some processes use
semaphores, but after they die, they don't return semaphores back to the
system.

When I checked semaphores with ipcs -s, I noticed that mostly of them are in
use by user root (184 out of 190).

I would like to find which process cause the problem, so I would like to get
the information, which process (PID) use the semaphore. How can I do that.

If I use ipcs -s -p I got nothing. It is look like switch -p doesn't work
for semaphores, only for shared memory.

I'm using RedHat Advanced Server 2.1.

Is there any idea, how can I determine PID whcih use semaphore?

Regards,
Lovro


Reply With Quote
  #2 (permalink)  
Old 11-17-2003
Scott Lurndal
 
Posts: n/a
Default Re: semaphores and PID

"Lovro VREŠ" <lovro@kopa.si> writes:
>Hello,
>
>I have a problem with a semaphores. It is look like some processes use
>semaphores, but after they die, they don't return semaphores back to the
>system.


None of the system V IPC resources (message queues, semaphores and shared
memory segments) are automatically returned upon process exit (quite simply
because they, by definition, are used by more than a single process).

The process must explicitly call semctl(,,ICP_RMID,) to remove the
semaphore when it is no longer needed.

The ipcrm command can be used to clean up after poorly written code or
in cases where it is not feasible for the application itself to remove
the semaphore.

>I would like to find which process cause the problem, so I would like to get
>the information, which process (PID) use the semaphore. How can I do that.


If ipcs(1) doesn't give you the information, you'll probably have to start
poking around in the kernel. Using kdb <http://oss.sgi.com/projects/kdb> may
be of some help.

If you don't feel comfortable with kdb (for which you'll need to build a
kernel), you'll have to disable all your services, reboot, then enable and
start them one at a time checking ipcs(1) between each one, until you
find the guilty culprit.

scott
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:53 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0