Question about proper usage and multiple querie s…?

Matthew M. DeLoera <[email protected]> Fri, 3 Aug 2012 00:39:09 -0400
Newsgroups gmane.comp.mozilla.devel.directory
Message-ID <[email protected]>
Hello,

I hope this list is still getting read. Haven't noticed any posts coming in=
to my inbox in a while!

Anyway, debugging strange crashes with mozldap 6.0.6 in Win7 64-bit. Still =
debugging, but wanted to throw out this question to know if I'm actually us=
ing the library as intended=85

Once I'm bound, my usage resembles:

ldap_search_ext(=85) -> returns 0 and msg ID 301
ldap_result(msg ID 301) -> returns 0
ldap_result(msg ID 301) -> returns 100
ldap_result(msg ID 301) -> returns 0
ldap_search_ext(=85) -> returns 0 and msg ID 311
ldap_result(msg ID 311) -> returns 0
ldap_search_ext(=85) -> returns 0 and msg ID 312
ldap_result(msg ID 312) -> returns 0
ldap_search_ext(=85) -> returns 0 and msg ID 327
ldap_result(msg ID 327) -> returns 0
ldap_result(msg ID 301) -> returns 0
ldap_result(msg ID 311] -> returns 0
ldap_result(msg ID 312] -> returns 0
ldap_result(msg ID 327] -> returns 0
ldap_result(msg ID 301] -> returns 0
ldap_result(msg ID 311] -> returns 100
ldap_result(msg ID 312] -> returns 100
ldap_result(msg ID 327] -> returns 100
ldap_result(msg ID 301] -> returns 0

Basically 4 searches at the same time, being checked in a loop. I do this a=
bout once per every 5 minute boundary. Everything runs fine for hours, and =
then finally:

ldap_result(msg ID 311] -> returns -1

Still looking to see if I'm accidentally calling abandon or unbind - not su=
re yet. But otherwise, isn't it really odd that message ID 311 returned -1 =
from ldap_result, after just returning 0 or 100? The LDAP error is "Bad par=
ameter to an ldap routine" and "unknown message id".

Anyway, my code then calls ldap_abandon_ext with message ID 311, which retu=
rns 0.

But then a subsequent call to ldap_result with message ID 312 crashes down =
in the memcache.

Anyway, is this reasonable usage? Or am I really only supposed to have 1 ac=
tive message ID at a time?

And I should mention that all 4 of my queries have identical filter strings=
. Kind of stupid I know, but was simpler for my coding. I think I'll patch =
to only execute a unique query once. But could there be memcache collision =
because of matching filter strings or matching returned DNs, even though th=
e message IDs are different? I studied the memcache code, and the key algor=
ithm seems like it's using message ID to keep from colliding.

And if ldap_result ever returns -1, should I just drop that message ID and =
not even try to call ldap_abandon_ext?

In any case, things do run for hours without any noticeable issues. Any sug=
gestions or insights would be *really* appreciated. Thanks!

Regards,
- Matthew