I haven't quite figured out everything that's going on, but this patch definitely shows when it occurs in test036:
Index: result.c =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap/result.c,v retrieving revision 1.140 diff -u -r1.140 result.c --- result.c 3 Dec 2006 23:11:12 -0000 1.140 +++ result.c 12 Dec 2006 22:53:25 -0000 @@ -914,6 +914,10 @@ }
if ( lr != NULL ) { + if ( tag == LDAP_RES_SEARCH_RESULT ) { + Debug( LDAP_DEBUG_TRACE, "request done: ld %p msgid %ld but mis-handled!\n", + (void *)ld, (long) id, 0 ); + } ldap_return_request( ld, lr, 0 ); lr = NULL; }
The response is actually returned to the caller properly, but we never decide to "mark request completed." Setting a breakpoint here will let you poke around at it. v3ref is set to V3REF_TOAPP at this point. This should mean that the result included a referral and it will be returned to the caller, which means that we can dispose of the request, but we never do.