Operating System - HP-UX
1820479 Members
2357 Online
109624 Solutions
New Discussion юеВ

Re: semaphores remain even after exiting the services

 
SOLVED
Go to solution
tarek_3
Frequent Advisor

semaphores remain even after exiting the services

On a machine running HP-UX 10.20, X.25 services are using semaphores. When stopping X.25 services and killing related daemons, the semaphores are not removed automatically, unless I use the command "ipcrm". So, when I start the services again another semaphores are created and consum more memory. Is it normal? Is there a way or workaround to remove the semaphores without any manual intervention.
8 REPLIES 8
Ravi_8
Honored Contributor

Re: semaphores remain even after exiting the services

Hi,
look like you have memory leak problem.
install a memory leak patch
never give up
Dietmar Konermann
Honored Contributor

Re: semaphores remain even after exiting the services

By design, semaphore sets are not automatically deleted by the system. Instead the application needs to take care of this during its cleanup code.

Usually this is done from their signal handlers... of course this works only unless you use SIGKILL (kill -9).

So the question is, how you stop your services and if they are designed to cleanup after them.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
tarek_3
Frequent Advisor

Re: semaphores remain even after exiting the services

i stop the application using kill -9.
these daemons are created to work 24/24.
but for some reasone i need to kill them using kill command.
the problem the daemons are started as root .
when i want to remove the semaphore , i cannot distinguish which are used by my daemeons to remove them.
Dietmar Konermann
Honored Contributor
Solution

Re: semaphores remain even after exiting the services

OK, the kill -9 explains why no cleanup is done by the daemons. Did your try a kill w/o -9 before?

BTW, I attached a tool which can be used to get more detailed semaphore information.

Try "ipcps -sa".

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Ravi_8
Honored Contributor

Re: semaphores remain even after exiting the services

Hi, tarek

when you issue the command ipcs, you could see last 2 colums OWNER and GROUP, clearly shows which ipcs is owned by whom.

here is a list from one of my server:
Semaphores:
s 0 0x411c05cc --ra-ra-ra- root root
s 1 0x4e0c0002 --ra-ra-ra- root root
s 2 0x412006a4 --ra-ra-ra- root root
s 3 0x00446f6e --ra-r--r-- root root
s 4 0x00446f6d --ra-r--r-- root root
s 5 0x01090522 --ra-r--r-- root root
s 6 0x311c3e3f --ra-ra-ra- root root
s 7 0x410c01c8 --ra-ra-ra- root root
s 8 0x3e147580 --ra-ra-ra- root root
s 9 0x3e147581 --ra-ra-ra- root root
s 10 0x3e147588 --ra-ra-ra- root root
s 11 0x3e147589 --ra-ra-ra- root root
s 26572 0x040400bc --ra-ra-ra- mqm mqm
s 29893 0x0404001d --ra-ra-ra- mqm mqm
s 49814 0x04040006 --ra-ra---- mqm mqm
s 979415 0x040400b2 --ra-ra---- mqm mqm
s 4395696 0x0404005d --ra-ra-ra- mqm mqm
s 4047097 0x040400e3 --ra-ra---- mqm mqm
s 3578978 0x040400fb --ra-ra-r-- mqm mqm
s 2649379 0x04040142 --ra-ra-r-- mqm mqm

the user mqm can terminate semaphores used by mqm
never give up
Dietmar Konermann
Honored Contributor

Re: semaphores remain even after exiting the services

Just saw, that the attachement didn't make it into the response. Drop me an EMail (forename.surname@hp.com) and I will send the tool directly to you.

Ravi, the problem is that the daemons run as root. So what should we see in ipcs -sa?

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
C.I.S
Frequent Advisor

Re: semaphores remain even after exiting the services

Hi Dietmar
My email is tarek_saliba@cis.com.lb
Mark Greene_1
Honored Contributor

Re: semaphores remain even after exiting the services

Instead of using the kill -9, try a kill -15 or a kill -4 first. If the daemons were written to generally accepted conventions, one or both of these signals will tell the process to clean-up after itself before going away.

HTH
mark
the future will be a lot like now, only later