- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shared memory cleanup
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2004 02:53 PM
10-31-2004 02:53 PM
In the system there are many shared memory segments with user as root. I got this from command ipcs -m
.I started some processes through root and they created so many shared memories. I want to now delete them .I can use ipcrm -m for this.
But the problem is if use ipcs -m, it is showing only user id.
How to find , which shared memories belongs to me?
Please help me in this regard as early as possible...because there are so many shared mem and i am about to run out of memory.
One thing i can do is restart the system.. But that is very bad way of doing the things
Ok folks help me..fast plzz
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2004 03:24 PM
10-31-2004 03:24 PM
Re: Shared memory cleanup
Try ipcs -mac,
Hope this helps to identify shared memory
which you can delete.
Thanks,
Amit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2004 03:44 PM
10-31-2004 03:44 PM
SolutionYou will get the PIDs of the process that created and that last accessed with 'ipcs -ma' command. Look at CPID and LPID columns. Also see "NATTCH" column. It indicates the number of processes that are attached now to this segment. If you see it 0 and if you don't find both CPID and LPID (pids of the processes that created and last accessed respectively)in the process list (ps), you can probably remove the segment. Again, pay atmost attention and verify things twice before you remove.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2004 04:45 PM
10-31-2004 04:45 PM
Re: Shared memory cleanup
Can you tell those sections apartm like from a create time?
If so, try sometking like:
ipcs -ma | awk '/x:xx:xx/{system("ipcrm -m " $2)}'
Enjoy,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2004 03:52 AM
11-01-2004 03:52 AM
Re: Shared memory cleanup
The most important word in the following is "PROBABLY":
"If you see it 0 and if you don't find both CPID and LPID (pids of the processes that created and last accessed respectively)in the process list (ps), you can probably remove the segment."
NATTACH being zero is a necessary but not necessarily sufficient condition for the removal of a shmid. It all depends on how the software using the shmid was written. For example, it rather common to have a process initialize a chunk of shared memory and them exit. Naatach is now zero, there are now active PID's associated with the shmid BUT if another process depends upon the shmid being there, it will die when the shared memory segment can't be found. This second process which needs the shmid might not be launched for days after the shared memory segment was initially created and populated with data. The moral of this is know your applications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2004 01:42 PM
11-01-2004 01:42 PM
Re: Shared memory cleanup
But my job is this. I am testing an application, which writen by some body( I cannot find them now) and studying the shared memory usage. I found that shared memory cleanup is doing by app. So I want to clean manually by hand for each run. In parllel some other team will look about this problem.
So my question, what is the exact and eligent way of cleaning shm mems.
I did'nt found LPID and CPID's in ps -ef, but NATTACHï¼ 0. So what I can do...
There are more than 500 shm's..And I want to make a clean run every time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2004 01:48 PM
11-01-2004 01:48 PM
Re: Shared memory cleanup
1. Shared mem is not cleaned by app.
2. NATTACH > 0
.
One more question..
If the KEY = 0x0000000, and MODE=D-rw-rw-rw-
, According to me, that is detached and i can safly delete that shm mem.
Is that right.???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2004 02:14 PM
11-01-2004 02:14 PM
Re: Shared memory cleanup
Well, in your case it's for sure a dirty job.
Usually applications do provide some debugging information like shmids at the time of shared memory creations or somewhere in the log files that indicate shmids. If the process is active, then you may get them if you run 'tusc'. I have a feeling that your application leaving some 'jombies' behind. and they are attached to the shared memory segments (hence NATTCH > 0). Your app is trying to delete the shared memory segment but since it is attached to those jombies, it's marked with a "D" is waiting for the jombies to terminate.
Now the question is how many such shared segments are seen with "D" Mode?. All 500?. In that case you will need to cleanup the processes rather than shared memory segments.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2004 02:49 PM
11-01-2004 02:49 PM
Re: Shared memory cleanup
1. If all the bad program segments are the same size, just use the ipcs remove command and see if any of the programs start crashing.
2. Remove the bad programs from the system so they won't interfere with normal operations. This is especially true for production systems that cannot go down due to programming errors.
3. Reboot the system.
Because the programs are so badly written, there is no 'correct' way to pick the segments for removal. Only the original programmer (hopefully) knows how to figure this out. Give the programmer a new job: shared memory manager
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2004 03:36 PM
11-01-2004 03:36 PM
Re: Shared memory cleanup
There are very less with "D" i.e., <5.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2004 03:40 PM
11-01-2004 03:40 PM
Re: Shared memory cleanup
>> There are more than 500 shm's..And I want to make a clean run every time
Did you see my earlier suggestion?
ipcs -ma | awk '/x:xx:xx/{system("ipcrm -m " $2)}'
This works very nicely for me for broken applications that do not clean up.
The trick is to put in the right 'xxxxxx'.
For me that is simply the username for the bad application.
For you it might be a size or a create time.
If there are still attaches, then at least the sections will become marked for delete and will go away when you kill the processes attached to it.
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2004 06:43 PM
11-01-2004 06:43 PM
Re: Shared memory cleanup
I always deleted all shm's which have the user id as mine. The problem here is I have shm's created by root. Because I run some users by root user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2004 06:48 PM
11-01-2004 06:48 PM
Re: Shared memory cleanup
Thanks for your valueble time.
The conclutions are:
1. First check the app, rather than try how to delete them.
2. try ipcs -ma to get LPID,CPID and NATTACH and depending on these values , confirm to delete it or not.
Thanks,
Sree