rethinkdb-java
rethinkdb-java copied to clipboard
Unable to reconnect with server after 2.4.1 update
Describe the bug
As of version 2.4.1 (and up to 2.4.4 of time of writing) the Connection.reconnect() method no longer works.
To Reproduce Simplified version of our code:
while(true){
if (!connection.isOpen()){
connection.reconnect(false);
}
Expected behavior There are 2 bugs in the code:
-
the connect method fails because the
socketfield is never set to null so theconnectAsynccall will always fail. https://github.com/rethinkdb/rethinkdb-java/blob/efd7c0aa5ac23a436870daae814174a83af83304/src/main/java/com/rethinkdb/net/Connection.java#L125-L128 -
The
reconnectmethod must be given a value offalse. If a value oftrueis used a query is attempted that will fail because it has no active connection. https://github.com/rethinkdb/rethinkdb-java/blob/efd7c0aa5ac23a436870daae814174a83af83304/src/main/java/com/rethinkdb/net/Connection.java#L447-L450