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

Re: Resend, slapd daemon.c error



At 01:25 PM 1/25/99 -0600, Robert Rothlisberger wrote:
>Resend I missed some things,
>
> Hello again,
>
>	I tracked down this error (below)

>	Basically when one thread is in the process of doing the
>	unbind, the main thread sees activity on the fd.  So I
>	added the following code to daemon.c . 

I think this should be fixed in connection_activity().
That is, I rather not complicate slapd_daemon() with issues
requiring knowledge of ldap state and operations..

>	Although the error probably does not cause any real damage.

It doesn't.

>	I prefer to not see any, since it makes it eaiser when tracking
>	down real problems.

But some activity after the unbind may actually be an error.
I rather have connection_activity() check to see if an unbind
has occurred.  If it has, then it should read() a byte.  If
the byte is read, we should report an error.  Otherwise we
should do something appropriate based upon the errno.

>	Questions
>	1) Can I assume that c[i].c_ops[0].o_tag be unbind?

No.  c_ops may be gone by the time you get there.

Actually, it looks like we might have a race condition on
the ber.  Hmmm...  I think we might need a lock on the ber
that wouldn't be released until each operation finishes
getting from the ber.  Either that or I need another coke.

>Are all operations
>		removed from the list until the last one left is the
>unbind?

Based upon my literal parsing, no.   operations are deleted when
they completed regradless of the unbind.

Looks like we also have a race after the close and before a
new connection on a descriptor that still has operations pending.
Looks like we should really close() the descriptor until all
pending operations completed (or abandoned). Maybe I better go
that coke now.

Kurt




  
>
>	2) Should the writewaiter be blocked also?
>
>
>	Bob Rothlisberger
>	rwroth@netdox.com
>
>//  daemon.c Line 177 (1.1.3)
>//  Do not cal FD_SET if the the last operation was an unbind.
>
>    for ( i = 0; i < dtblsize; i++ ) {
>         if ( c[i].c_sb.sb_sd != -1 ) {
>           if ( c[i].c_ops ) {
>              if ( c[i].c_ops[0].o_tag != LDAP_REQ_UNBIND &&
>                   c[i].c_ops[0].o_tag != LDAP_REQ_UNBIND_30 ) {
>
>                         FD_SET( c[i].c_sb.sb_sd, &readfds );
>			}
>			// Do not set bit if we are in the process of
>unbinding
>		}
>            else
>               FD_SET( c[i].c_sb.sb_sd, &readfds );
>
>            if ( c[i].c_writewaiter ) {
>               FD_SET( c[i].c_sb.sb_sd, &writefds );
>            }
>            Debug( LDAP_DEBUG_CONNS, " %dr%s", i,
>                c[i].c_writewaiter ? "w" : "", 0 );
>         }
>
>
>
>send_ldap_result 68::
>ber_flush: 14 bytes to sd 5
>         0 0c 02 01 02  i 07 0a 01  D 04 00 04 00 
>conn=0 op=1 RESULT err=68 tag=105 nentries=0
>select activity on 1 descriptors
>activity on: 5r
>read activity on 5
>ber_get_next
>ber_get_next: tag 0x30 len 5 contents:
>ber_dump: buf 0x5bad8, ptr 0x5bad8, end 0x5badd
>          current len 5, contents:
>        02 01 03  B 00 
>do_unbind
>conn=0 op=2 UNBIND
>listening for connections on 3, activity on: 5r
>before select active_threads 1
>select activity on 1 descriptors
>conn=0 op=2 fd=5 closed errno=0
>activity on: 5r
>read activity on 5
>ber_get_next
>ber_get_next on fd -1 failed errno 9 (Bad file number)
>*** got 0 of 0 so far
>listening for connections on 3, activity on:
>before select active_threads 0
>
>
>
>