directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <>
Subject Paged Search issues
Date Sun, 16 May 2010 23:48:21 GMT
Hi guys,

as everyone who build the server from time to time knows, we have random 
errors in PagedSearch tests.

Stefan spent some time to see what's going on, and I must admit I was 
lazzy enough to accept the idea that we have errors in this area, until 
I move my butt to fix it.

So I checked the code, and I found a couple of major errors in this code 
(and as I wrote it, I'm responsible for this) :
- first, I wrongly assumed that the cookie would be 4 bytes long, as it 
was stored in an int on the server. Nothing could be more wrong, as an 
int BER encoded can be from 1 to 4 bytes. We had situation where, when 
the cookie was encoded on 3 bytes only, we had an internal AIOOBE. I 
fixed that.
- second, the cookie was computed based on the message id plus a time 
based number (System.nanoseconds(), namely). This is *stupid*. There are 
potential collisions when computig such a cookie. I changed it to use an 
AtomicInteger - which as a side effect removed the local synchronization 
- and a 16 bits shift to the left to allow 2^16 cookie renewig for a 
single message - more than enough to cover every cases.

I still have random issues at this point, but less frequently. What 
happens is that we receive a searchRequest with a cookie, just after the 
previous request has been completed. I have no idea why. If I add a 
Thread.sleep(10) in the doLoop() method of the test, I'm able to run 
10000 times the paged search ( this is 40 000 paged search requests...).

I will try tomorrow the same test but using our API instead of JNDI.

Will keep you informed.

Emmanuel L├ęcharny

View raw message