rethinkdb-java
rethinkdb-java copied to clipboard
Result hasNext() Hangs Forever
Describe the bug
I'm running into an odd bug where result.hasNext()
hangs forever after successfully iterating through all of the expected results of a query. I have an application where I need to load the contents of a table at startup, which I've implemented like so:
private Table http() {
return r.db(dbName).table(HTTPTable);
}
private void initalizeHistory() {
logger.debug("Initializing history ...");
try {
Result<MultiplayerRequestResponse> result = http().run(dbConn, MultiplayerRequestResponse.class);
logger.debug("Got history ...");
while (result.hasNext()) {
MultiplayerRequestResponse entry = result.next();
logger.debug("Got entry: %s", entry);
history.add(entry);
}
logger.debug("Results done.");
} catch(Exception err) {
logger.error(err);
}
logger.debug("History initialized");
}
When the code runs I get the following in the log files, it loads the expected data but then the hasNext()
hangs forever when it should terminate the loop. Note that I never get the Results done.
or History initialized
log messages from the code. I can also comment out the history.add(entry)
code and observe the same behavior, so it would seem to be an issue with the Java driver:
Successfully connected: com.rethinkdb.net.Connection@636a9651
Initializing history ...
Got history ...
Got entry: <id: b4d5b0d0a40aa9aada0ba6d9d3fecdb66957e702, method: GET, protocol: https, host: www.bishopfox.com, port: 443, path: /services/, comment: >
Got entry: <id: 0e42eddb67a6a871b27018e3aef4ae3a521fa21d, method: GET, protocol: https, host: api.hubapi.com, port: 443, path: /hs-script-loader-public/v1/config/pixel/json, comment: >
Got entry: <id: 2cd12678b8d72e5a597e49a7c0abac2415638c75, method: GET, protocol: https, host: api.hubspot.com, port: 443, path: /livechat-public/v1/message/public, comment: >
Got entry: <id: f9eaea5653fab7033e6d3975fd0705f15ea874a8, method: OPTIONS, protocol: https, host: api.hubspot.com, port: 443, path: /livechat-public/v1/message/public, comment: >
... and then the app dies, hanging forever.
System info
- Java: 13.0.1
- RethinkDB Version:
rethinkdb 2.4.1~0buster (CLANG 7.0.1 (tags/RELEASE_701/final))