Operating System - HP-UX
1840255 Members
2775 Online
110162 Solutions
New Discussion

shared memory deleted but not freed

 
SOLVED
Go to solution
Tony Flaherty
Frequent Advisor

shared memory deleted but not freed

Hi,

I have a new rp5430 factory installed with hpux 11i.

I have this o/put from ipcs -m
PC status from /dev/kmem as of Tue Sep 3 14:33:56 2002
T ID KEY MODE OWNER GROUP
Shared Memory:
m 0 0x411c025d --rw-rw-rw- root root
m 1 0x4e0c0002 --rw-rw-rw- root root
m 2 0x412009f0 --rw-rw-rw- root root
m 3 0x301c63c0 --rw-rw-rw- root root
m 5636 0x06347849 --rw-rw-rw- root root
m 5 0x0c6629c9 --rw-r----- root root
m 518 0xffffffff --rw-r--rw- root root
m 1031 0x00000000 D-rw------- root root
m 2568 0x00000000 D-rw------- www other
m 22537 0x52594801 --rw-rw---- root informix
m 1034 0x52594802 --rw-rw---- root informix
m 1035 0x52594803 --rw-rw-rw- root informix

the two entries marked as deleted are always present, even immediatly after a reboot.

Can anyone give me some directions in tracking down the source of these, I'm guessing something is failing during the boot but I can't finds anything in /etc/rc.log or the syslog.
There are 10 types of people in the world, Those who understand Binary and those who don't.
8 REPLIES 8
A. Clay Stephenson
Acclaimed Contributor

Re: shared memory deleted but not freed

A shared memory identifier is left in this state when the shmid has beem removed but at least one process still has the segment attached. An ipcs -ma should give you the last PID and the number of attaches. That should give you the data that you need.
If it ain't broke, I can fix that.
Paula J Frazer-Campbell
Honored Contributor

Re: shared memory deleted but not freed

HI

ipcs -ma and pick up the cpid-

Then ps -ef | grep

Should give you a pointer.

Paula
If you can spell SysAdmin then you is one - anon
Tony Flaherty
Frequent Advisor

Re: shared memory deleted but not freed

Thanks for the replies!

The segment owned by www is /opt/apache/bin/httpd
but the process shown for the segment owned by root does not exist!

T ID KEY MODE OWNER GROUP CREATOR CGROUP NATTCH SEGSZ CPID LPID ATIME DTIME CTIME
Shared Memory:
m 1031 0x00000000 D-rw------- root root root root 8 1052672 1997 1997 10:48:07 no-entry 10:48:07
m 2568 0x00000000 D-rw------- www other root root 8 184324 2003 2003 10:48:11 no-entry 10:48:11
hpl5430:/etc> ps -ef|grep 1997
root 5445 3882 0 15:27:11 ttyp8 0:00 grep 1997



As an aside what are the units for SEGSZ ?

Thanks in advance

Tony.
There are 10 types of people in the world, Those who understand Binary and those who don't.
A. Clay Stephenson
Acclaimed Contributor

Re: shared memory deleted but not freed

When I saw the owner, www that was pretty much a giveaway for Apache but it's not unusual for the creating process to be defunct. It's job may have simply been to create the shmid and then load data and exit for subsequent attachment by other processes. The units of sessz are bytes. Notice that you have 8 attaches to these shmid's; that's your problem. Eventhough the creating process is gone the last attached process may still be present.

By any chance, have you used kill -9? That's the most common cause for this situation.
If it ain't broke, I can fix that.
Tony Flaherty
Frequent Advisor

Re: shared memory deleted but not freed

Thanks for the reply,

No I have not killed anything, I see these segments immediately after booting the server!

I can browse to the apache server on the machine, so it's not died, at least not completely.

I take it there are no commands for listing the pids of all attached processes, I cant seem to find one :o(

Cheers,

Tony
There are 10 types of people in the world, Those who understand Binary and those who don't.
John Palmer
Honored Contributor
Solution

Re: shared memory deleted but not freed

Hi,

This appears to be normal behaviour for Apache, I've got the same symptoms on several AIX servers.

The attach count equals the number of Apache processes that are running.

Regards,
John
Bill Thorsteinson
Honored Contributor

Re: shared memory deleted but not freed

Apache will use shared memory if available to maintain its
scoreboard (control structure). Alternatively,
it will used disk.

As the main process forks off children as needed, I would
expect they delete the id
so that it will be cleaned up
if apache dies or is killed.

Both deleted segements may belong to apache. What starts
just before informix? The first segment was created
within the last three scripts run before informix started.
Tony Flaherty
Frequent Advisor

Re: shared memory deleted but not freed

Mmm, Apache does not start 3 scripts before Informix, it's closer to 10, 3 back is fc_td which is fibre Channel, which we're not using, perhaps I need to track back all of these scripts, it could be that Apache is the third one back that we are actually using.

I'm assuming you get the 3 from the ID, however doesn't that assume that every script run claims some shared memory, I wouldn't have thought this was the case.

Tony
There are 10 types of people in the world, Those who understand Binary and those who don't.