Skip to content

Commit

Permalink
[#1267][followup] improvement(client): The previous exception may be …
Browse files Browse the repository at this point in the history
…discarded when OOM occurs
  • Loading branch information
rickyma committed Jan 13, 2024
1 parent 3194717 commit 3b9d9fe
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,7 @@ private boolean tryAccessCluster() {
return canAccess;
} catch (Throwable e) {
LOG.warn(
"Fail to access cluster {} using {} for {}",
coordinatorClient.getDesc(),
accessId,
e.getMessage());
"Fail to access cluster {} using {} for ", coordinatorClient.getDesc(), accessId, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,26 @@ public static <T> T retryWithCondition(
Function<Throwable, Boolean> isRetryFunc)
throws Throwable {
int retry = 0;
Throwable previousThrowable = null;
while (true) {
try {
return cmd.execute();
} catch (Throwable t) {
retry++;
if (isRetryFunc.apply(t) && retry < retryTimes) {
previousThrowable = t;
LOG.info("Retry due to Throwable, " + t.getClass().getName() + " " + t.getMessage());
LOG.info("Waiting " + intervalMs + " milliseconds before next connection attempt.");
if (LOG.isDebugEnabled()) {
LOG.error("Retry due to Throwable ", t);
} else {
LOG.error(
"Retry due to Throwable {}. Use DEBUG level to see the full stack: {}",
t.getClass().getName(),
t.getMessage());
}
LOG.error("Will retry {} more time(s) after waiting {} milliseconds.", retryTimes - retry, intervalMs);
Thread.sleep(intervalMs);
if (callBack != null) {
callBack.execute();
}
} else {
if (previousThrowable != null) {
LOG.error("The previous retry failed due to ", previousThrowable);
}
throw t;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public RssSendShuffleDataResponse sendShuffleData(RssSendShuffleDataRequest requ
maxRetryAttempts,
t -> !(t instanceof OutOfMemoryError));
} catch (Throwable throwable) {
LOG.warn(throwable.getMessage());
LOG.warn("Failed to send shuffle data due to ", throwable);
isSuccessful = false;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public RssSendShuffleDataResponse sendShuffleData(RssSendShuffleDataRequest requ
maxRetryAttempts,
t -> !(t instanceof OutOfMemoryError));
} catch (Throwable throwable) {
LOG.warn(throwable.getMessage());
LOG.warn("Failed to send shuffle data due to ", throwable);
isSuccessful = false;
break;
}
Expand Down

0 comments on commit 3b9d9fe

Please sign in to comment.