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

Re: ldap_result() fails on large results



Hi,

On Tuesday 13 May 2003 10:44, Patrick Dreyer, SY-UCP wrote:
> I'm doing a search with ldap_search_ext() which returns 1000 results.
> The problem is, that ldap_result() fails during processing the results
> and returns with -1 and zero for the LDAPMessage.
> If I'm doing a sleep between calling ldap_search_ext() and ldap_result()
> for at least 500ms everything works. It works too, if I limit the amount
> of results on calling ldap_search_ext() with sizelimit set to 500.
> Both "solutions" do not help because I don't want to limit the amount of
> results and doing a sleep... :-(
>
> Had anybody similar problems or is there even a solution around this?

I have a similar / the same problem.
For me  ldapsearch, which uses ldap_result(), fails on a fast machine when
performing a large search.
The search is a complete search of a Novell eDirectory with about 70.000
objects.

When searching unsorted (the regular way), the loop around ldap_result()
ends prematurely.
Funnily, for th same search it always ends at the same amount of data.
For other searches the last entry fetched is different, but for each search
it is always the same entry.

When the search is done sorted by an attribute (option -S), ldap_result()
is called only once and everything works.

As a workaround we use an old version of ldapsearch (from OpenLDAP 2.0.23)
that has been compiled statically and included the libraries ;-)

I have filed an ITS (#2490) about the problem, but did not get any response.

Peter




> Platform:		WinXP
> OpenLDAP version:	2.1.19
>
> Where some debugging got me too:
>
> Call stack:
>  - ldap_result()
>  - wait4msg()
>  - try_read1msg()
>  - ber_get_next()
>
> wait4msg() (result.c v 1.64.2.12)
> ==========
> Line 350:
>   if ( lc->lconn_status ==
>       LDAP_CONNST_CONNECTED &&
>       ldap_is_read_ready( ld,
>       lc->lconn_sb )) {
>     rc = try_read1msg( ld, msgid, all,
>         lc->lconn_sb, lc, result );
>   }
>
> try_read1msg() returns with -1.
>
> read1msg() (result.c v 1.64.2.12)
> ==========
> Line 445:
>   if ( (tag = ber_get_next( sb, &len, ber ))
>       != LDAP_TAG_MESSAGE ) {
>     if ( tag == LBER_DEFAULT) {
>
> ber_get_next() returns with LBER_DEFAULT.
>
> ber_get_next() (io.c v 1.70.2.10)
> ==============
> Line 641:
>   if ((ber->ber_rwptr>=ber->ber_buf) && (ber->ber_rwptr<ber->ber_end)) {
>
> ber->ber_rwptr is not between ber->ber_buf and ber->ber_end and so the
> line 680
>
>   assert( 0 ); /* ber structure is messed up ?*/
>   return LBER_DEFAULT;
>
> is reached.

-- 
Peter Marschall
eMail: peter@adpm.de