[python-ldap] LDAP pagination cookie not working across AD server restart

Ritesh Nadhani riteshn at gmail.com
Thu Jan 5 13:03:51 EST 2017


Hello

I am writing a script that would poll an AD with 250K user
information. It looks something like (from which I took code
inspiration):

https://gist.github.com/mattfahrner/c228ead9c516fc322d3a

To be resilient of server restarts and my app crashing, I am writing
the cookie into a file and reading it from there in the next
iteration.

Everything works and even my script crashes, on restart it picks up
the right cookie file from storage and starts from the correct offset
(ignoring users that have already been fetched).

The problem seems to be that, while the operation is going on if I
restart the server, I get SERVER_DOWN exception, on which case I just
re-setup the connection again after the server is back and continue on
the loop. Unfortunately, in this case, using the older cookie gives
me:

UNAVAILABLE_CRITICAL_EXTENSION: {'info': '00000057: LdapErr:
DSID-0C0907B8, comment: Error processing control, data 0, v2580',
'desc': 'Critical extension is unavailable'}

..

and I cannot figure out the issue. The cookie way works brilliant if
my app and the network IO behaves correctly. If my app crashes, I can
restart and reuse the cookie with a new connection object.

But if I restart the AD server itself, reconnecting and using the
cookie does not work.

Is it not possible?


-- 
Ritesh


More information about the python-ldap mailing list