Skip to content

Commit

Permalink
Retry randomUUID() to mitigate intermittent java NativeSeedGenerator …
Browse files Browse the repository at this point in the history
…failure (#1705)

* Retry once

* Added logging

* Changed logging level
  • Loading branch information
VeryVerySpicy authored Dec 8, 2021
1 parent 50b1251 commit 901ec95
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3178,7 +3178,17 @@ private InetSocketAddress connectHelper(ServerPortPlaceHolder serverInfo, int ti

setState(State.Connected);

clientConnectionId = UUID.randomUUID();
try {
clientConnectionId = UUID.randomUUID();
} catch (InternalError e) {
// Java's NativeSeedGenerator can sometimes fail on getSeedBytes(). Exact reason is unknown but high system
// load seems to contribute to likelihood. Retry once to mitigate.
if (connectionlogger.isLoggable(Level.FINER)) {
connectionlogger.finer(toString() + " Generating a random UUID has failed due to : " + e.getMessage() + "Retrying once.");
}
clientConnectionId = UUID.randomUUID();
}

assert null != clientConnectionId;

Prelogin(serverInfo.getServerName(), serverInfo.getPortNumber());
Expand Down

0 comments on commit 901ec95

Please sign in to comment.