rethinkdb / rethinkdb-java

Official RethinkDB Java client
https://rethinkdb.com/api/java/
Apache License 2.0
21 stars 10 forks source link

Unable to reconnect with server after 2.4.1 update #73

Open gjhommersom opened 9 months ago

gjhommersom commented 9 months ago

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:

  1. the connect method fails because the socket field is never set to null so the connectAsync call will always fail. https://github.com/rethinkdb/rethinkdb-java/blob/efd7c0aa5ac23a436870daae814174a83af83304/src/main/java/com/rethinkdb/net/Connection.java#L125-L128

  2. The reconnect method must be given a value of false. If a value of true is 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