RFR [6968459] JNDI timeout fails before timeout is reached

Ivan Gerasimov ivan.gerasimov at oracle.com
Fri Nov 29 20:06:38 UTC 2013

Thank you Alan for the reply!

On 29.11.2013 21:03, Alan Bateman wrote:
> On 19/11/2013 17:58, Ivan Gerasimov wrote:
>> Hello all!
>> Would you please help review a fix for the bug?
>> https://bugs.openjdk.java.net/browse/JDK-6968459
>> It was reported that creating new InitialLdapContext() can fail with 
>> "javax.naming.NamingException: LDAP response read timed out, timeout 
>> used:30000ms", even though the specified timeout hadn't been elapsed.
>> The fix was provided by the filer of the bug some time ago.
>> Here's the webrev with this fix:
>> http://cr.openjdk.java.net/~igerasim/6968459/0/webrev/
> I haven't seen any replies to this but I've cc'ed Vinnie and Xuelei as 
> they are more familiar with this area.
> If I understand correctly then the issue is that the timeout handling 
> doesn't take account of wakeups when aren't any BerDecoders to 
> dequeue. The changes mean it will retry the wait with a decreasing 
> timeout until a reply is received or the timeout elapses. That seems 
> reasonable, assuming the time doesn't change :-)   You might find the 
> code is a bit clearer if you have a "remaining" time as that would 
> allow you get rid of timedOut, timeOut and endTime.
I modified the patch in the way you suggest.

The timeOut variable now holds the remaining time.
If the system time had changed back, we start counting from the beginning.
If it had changed forward, we have no way to catch it and the timeout 
gets elapsed earlier.

> I see the patch doesn't come with a test. Is there any test 
> infrastructure for testing LDAP without require a complete server?
I didn't find anything like that, that's why I set 'noreg-hard' label.

Sincerely yours,

> -Alan.

More information about the core-libs-dev mailing list