[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: openldap Deadlock on Solaris



Hi Ron

Thanks a lot for your reply regarding locking issues with openssl and
Sun/Solaris. I've applied your suggested changes now to my HP-UX
installation, to my best knowledge and I seem not to be getting any locks
anymore.

But I am not quite sure whether I got you right:
> ... For one, in main.c ignore SIGCHLD.

I removed the signal setup for SIGCHLD in main.c that uses wait4child as
the signal function.

> in daemon.c add a call to wait4child() in the main loop, just before the
> select() call.

So I copied the wait4child function code from main.c to daemon.c, added
the prototype as well and then added the line:
wait4child( SIGCHLD );
just before the line:
switch(ns = select( nfds, &readfds, ...

Now, I get no locking and no defunct processes anymore, but I'm not quite
sure whether I still run my requests in parallel or whether they get
serialized because of the wait4child.

Do I have to call wait4child like this in daemon.c or do I have to install
a signal handler, just like it was in main.c?

Thanks a lot for your help again

Bye
Tim


On Mon, 27 Nov 2000 09:16:46 -0500
"Kunkel, Ronald Dale (Ron)" <rdkunkel@lucent.com> wrote:

> I had a similar issue and also posted a request about this "surrogate"
> parent question.
> I never really got a satisfactory response. However, my own
investigation
> revealed that
> the problem was related to signal processing. In main.c,  there is a
signal
> call to setup
> a signal catching routine called "wait4child()" to catch a death of
child
> signal. This basically is a clean up mechanism to keep from accumulating
> "defunct" processes.
> 
> At any rate, the receipt of this signal really seemed to screw up the
stdio
> routines for
> gathering input from the backend shells that may be outstanding at the
time.
> In other words, if one of the shells exited at just the wrong time, the
> whole slapd 
> would get deadlocked in a stdio call. The work around that I employed
was
> simple
> and has seemed so far to be effective. For one, in main.c ignore
SIGCHLD.
> Then
> in daemon.c add a call to wait4child() in the main loop, just before the
> select() call.
> This way the child processes will be cleaned up, but the signal will not
> pose a problem.
> 
> Hope this helps.
> 
> 			Ron Kunkel
> 
> > ----------
> > From: 	Tim Tassonis[SMTP:timtas@webshuttle.ch]
> > Sent: 	Friday, November 24, 2000 4:45 AM
> > To: 	openldap-devel@OpenLDAP.org
> > Subject: 	Deadlock on Solaris
> > 
> > Hi
> > 
> > I've written a shell backend for openldap and it works quite well.
> > 
> > However, when I start several requests at the same time, my programs
start
> > to lock each
> > other and the whole slapd process locks until I kill all the started
> > programs.
> > 
> > In fork.c in back-shell, it says:
> >         /*
> >          * child could deadlock here due to resources locked
> >          * by our parent
> >          *
> >          * If so, configure --without-threads or implement forking
> >          * via a surrogate parent.
> >          */
> > 
> > which seems to be the case when I have multiple threads working at the
> > same time.
> > 
> > The "configure --without-threads" is not really an option, since I
have to
> > have parallel processing and as far as I know there is no multiprocess
> > mode (like in Apache) in openldap.
> > 
> > Can anybody tell me what "implement forking via a surrogate parent"
means?
> > 
> > As a note; On Linux, I get no locking problems, only on Solaris (2.6).
> > Does anybody know aboout locking problems on HP-UX?
> > 
> > Bye
> > Tim
> > 
> > 
> > 
> > --
> > 
>