Re: sem_open() returns ENOSPC
Re: sem_open() returns ENOSPC
- Subject: Re: sem_open() returns ENOSPC
- From: Norm Green <email@hidden>
- Date: Wed, 14 Jul 2010 15:42:24 -0700
As I said in my post, the process is in start-up when I get the error,
so I'm confident I don't have a leak at this point. Do I need to call
sem_close() even if the process terminates?
On 7/14/10 3:33 PM, Alastair Houghton wrote:
On 14 Jul 2010, at 22:49, Mo McRoberts wrote:
On 14-Jul-2010, at 22:44, Norm Green wrote:
Hi,
We have a problem where sem_open() returns ENOSPC. This occurs during program startup and repeats until we reboot the machine. Then it goes away for awhile but eventually returns until we reboot the machine again. Is there a better solution than restarting the machine?
I'm guessing you've already run 'ipcs' when this problem occurs, and it's not listing lots of semaphores?
ipcs only lists SysV semaphores, whereas the OP is using POSIX semaphores (so it won't help). I'm not sure that there is any equivalent for POSIX semaphores (which is a bit of a shame, actually).
Anyway, I agree with your implied diagnosis; the kernel will return ENOSPC if you allocate more than posix_sem_max (default 10,000, configurable via sysctl as kern.posix.sem.max) semaphores. Most likely the OP is leaking semaphores somehow (possibly some sem_close() and sem_unlink() calls are needed somewhere?)
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden