Skip to content

WriteTimeoutHandler throw an IllegalStateException #178

@arcadmlafon

Description

@arcadmlafon

For a reason I can not explain, the com.unboundid.ldap.sdk.WriteTimeoutHandler try to schedule a task on a cancelled Timer:

Caused by: java.lang.IllegalStateException: Timer already cancelled.
at java.util.Timer.sched(Timer.java:397)
at java.util.Timer.schedule(Timer.java:248)
at com.unboundid.ldap.sdk.WriteTimeoutHandler.(WriteTimeoutHandler.java:138)
at com.unboundid.ldap.sdk.LDAPConnectionInternals.(LDAPConnectionInternals.java:178)

This error appears from time to time while getting a new connection from a pool through the following call stack:

at com.unboundid.ldap.sdk.LDAPConnection.connect(LDAPConnection.java:915)
at com.unboundid.ldap.sdk.LDAPConnection.connect(LDAPConnection.java:802)
at com.unboundid.ldap.sdk.LDAPConnection.connect(LDAPConnection.java:740)
at com.unboundid.ldap.sdk.LDAPConnection.(LDAPConnection.java:560)
at com.unboundid.ldap.sdk.SingleServerSet.getConnection(SingleServerSet.java:329)
at com.unboundid.ldap.sdk.FailoverServerSet.getConnection(FailoverServerSet.java:688)
at com.unboundid.ldap.sdk.LDAPConnectionPool.createConnection(LDAPConnectionPool.java:1297)
at com.unboundid.ldap.sdk.LDAPConnectionPool.createConnection(LDAPConnectionPool.java:1269)
at com.unboundid.ldap.sdk.LDAPConnectionPool.getConnection(LDAPConnectionPool.java:1866)
...

When the problem occurs, it seams to deadlock the LDAP connections and we need to shutdown our program to be able to reconnect with the LDAP server... anyway this is really hard to reproduce, and quite impossible to reproduce in debug.

The UnboundId library used in version 6.0.5, with Java 1.8.

I can't see how the timer could be cancelled before it is used to schedule a new task, the synchronization block look correct... may except the cancel() method call in the destroy() one which should be synchronized too (because the Timer's purge() method may cancel the timer if the task is the last one...)

I am going to try to get more information on what could have been append before this error occurs. And make more test with higher versions (of UndoundID and Java).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions