Operating System - HP-UX
1830893 Members
3117 Online
110017 Solutions
New Discussion

semaphores and shared memory (error on SEMOP 28)

 
SOLVED
Go to solution
Indira Aramandla
Honored Contributor

semaphores and shared memory (error on SEMOP 28)

We are runing HP-UX 11.11 (64-bit) with oracle 8.1.7.4 (32-bit). And we have COBOL application (MF Object COBOL 4.2 32-bit) and ANSI C++ applications. When we run a COBOL batch program or a C++ program, there is a routine to remove semaphores and shared memory areas at application termination. This routine returns an error "error on SEMOP 28 - SEM: too many sems/undos, SHM: too many areas".

Can any one please tell what KERNEL parameters limit (eg : semeam......)must be increased to overcome this error.
Never give up, Keep Trying
11 REPLIES 11
Massimo Bianchi
Honored Contributor
Solution

Re: semaphores and shared memory (error on SEMOP 28)

Hi,

If the errors are the ones you printed, i suggest to change the following parameters:

semmni (NPROC*5)
semmns (SEMMNI*2)
semmnu (NPROC-4)
semume 512
semvmx 32768


my NPROC is 2048

(parameters from a production environtment)


semmnu is the number of undo structures
semume is the number of undo entries per processor.

But, why do you use an ad hoc application to clear semaphores and shared memory ? Usually applications can get rid of their stuff quite weel, may be a second look at the code might also help.

HTH,
Massimo


T G Manikandan
Honored Contributor

Re: semaphores and shared memory (error on SEMOP 28)

most probably you can receiving this error because the undo operations
requested by processes is exceeding the kernel limits.

you need to increase the value of semmnu.

you need to increase them on the kernel.
you can use
sam--->kernel configuration--->

increase the value of semmnu
then rebuild the kernel and a reboot.

check the man pages of semop.

http://docs.hp.com/hpux/onlinedocs/939/KCParms/KCparam.SemMNU.html

The default value is 30.Try increasing to 100.

revert after the results

Thanks
Steven E. Protter
Exalted Contributor

Re: semaphores and shared memory (error on SEMOP 28)

Indira,

It might not be an increase that is in order. You may have too many shared memory segments or are chopping the ones you have up in too many little pices.

Take a look at the output from the command ipcs when you get this error. Is it a horror show? Is it difficult to follow?

I would look at shmseg and shmmax, but perform a review and collect some data to get a better idea of whats wrong.

I am attaching a few scripts that might help.

Regards and Good Luck,

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Indira Aramandla
Honored Contributor

Re: semaphores and shared memory (error on SEMOP 28)

Hi Every One,

Thanks for the replies / suggestions. By configuting the parameters and restarting the server, now I can start two of the applications.

When I start the third application, I get the following error.
Error loading /opt/lib/cobol/coblib/libhpcobol.2, errno = 2
/usr/lib/dld.sl: Call to mmap() failed - TEXT /opt/lib/cobol/coblib/libhpcobol.2
/usr/lib/dld.sl: Not enough space

This error pops up when I use sudo as a different user and try to bring other application.

There are the current KERNEL parameters.

dbc_max_pct = 12 (was 50 earlier)
maxdsiz = 896MB
nproc = 4116
semeam = 21898
semmap = 2924
semmni = 2922
semmns = 5844
semmnu = (NPROC-4)=4112
semmsl = 5122
semume = 512
semvxm = 32768
shmmax = 1610612736

Can some on please explain what to be done for the above error.

Thanks in advace
Indira

Never give up, Keep Trying
Massimo Bianchi
Honored Contributor

Re: semaphores and shared memory (error on SEMOP 28)

Hi,
i think that this error is related to memory.
How is your swap ? Please post a
swapinfo -mt

HTH,
Massimo
Indira Aramandla
Honored Contributor

Re: semaphores and shared memory (error on SEMOP 28)

Hi,

Here it is
swapinfo -mt
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 2048 0 2048 0% 0 - 1 /dev/vg00/lvol2
dev 1024 0 1024 0% 0 - 2 /dev/vg02/swap2
dev 3072 0 72 0% 0 - 2 /dev/vg02/swap3
reserve - 434 -434
memory 708 94 614 13%
total 6852 528 3324 8% - 0 -
Never give up, Keep Trying
Massimo Bianchi
Honored Contributor

Re: semaphores and shared memory (error on SEMOP 28)

Hi,
i checked against a productive server, with MF Cobol and AnsiC.

I think that, besides memory, there may be other kernel parameters, like

Various data, stack, text sizes

maxdsiz 1073741824
maxssiz 0X05000000
maxssiz_64bit 0X05000000
maxtsiz 0x10000000

swap related:

maxswapchunks 16384

But let's wait for other suggestion before making changes.

HTH,
Massimo
Indira Aramandla
Honored Contributor

Re: semaphores and shared memory (error on SEMOP 28)

Hi,

Thanks for the prompt replies. I have checked the document. Where it says 32-bit oracle on 64-bit OS has limit for shared memory to consume only 1.7 GB memory. This can be rectified by jmemory windows feature.

But they say we can use this memory window feature only if we cannot make use of of our complete available memory. We just have 1 GB physical RAM.

So do you think it is viable.

Never give up, Keep Trying
Massimo Bianchi
Honored Contributor

Re: semaphores and shared memory (error on SEMOP 28)

Hi,
the problem *seems* (i'm not sure) that when you try to start all your application, thet go in conflict for ram usage.

Since they are all 32bit application, they share the first 1,7Gb of RAM.
This means that oracle, Cobol interpreter and you programs all share the same memory.

So, the last to come may go into problem in finding enough space in memory free, or a sufficient large area.

How is your sga ? (check with svrmgrl> "show sga"). This usually takes up a good bunch of RAM. Next you apps take the remainig.

You said you have just 1G of phisical RAM, but you defined about 5Gb of swap, so that your apps can lock large area of memory. This means, to me, that you know your process will reclaim much memory.

And they go all in the first part of the RAM.
If your C code is 64bit it can go in the upper memory, otherwise is another fellow reclaiming memory, and all of them reclaming the first 1,7Gb, not using anything beyond it.

This is not related to the physical memory you have, but to how much your process ask for.

For this purpose, if it is your case, you can use the memory window, to use the other areas.
You have also to check if your code works properly, althought this should be transparent.
It should be masqueraded by the S.O., but since you wrote code to clean semahpores and memory segment, you may incurr into problems.

Remember also that if you plan to use much memory, you must check for paging, to avoid performance problems. Or add more ram, but this is oblivious..

Here is a little script (Thanks to Twang) to check memory usage of a user, try it to see how much is allocated.


#!/bin/ksh

t=0
for j in `UNIX95= ps -e -o vsz=Kbytes -o ruser -o pid,args=Command-Line | sort -
rnk1 | grep -v Kbytes | grep | awk '{print $1}'`
do
t=`expr $t + $j`
done
echo "\nMemory claimed by : $t Kbytes .\n"

HTH,
Massimo


RAC_1
Honored Contributor

Re: semaphores and shared memory (error on SEMOP 28)

Check ipcs to know semaphores usage.

What you can is start one program at a time and check mem usage as suggested by UNIX95.

This would tell when you are running into a problem.

I would also suggest to have look at all semaphores & shared memory kernel values.

There is no substitute to HARDWORK
Indira Aramandla
Honored Contributor

Re: semaphores and shared memory (error on SEMOP 28)

Thread closed
Never give up, Keep Trying