Skip to content

Commit

Permalink
[apache#1267] improvement(client): throw the detailed stacktrace when…
Browse files Browse the repository at this point in the history
… exceptions happened (apache#1411)

### What changes were proposed in this pull request?

Save the previous exception in advance to prevent it from being lost during the next retry.

### Why are the changes needed?

This is the follow up pr of  [apache#1344](apache#1344)

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Existing UTs.
  • Loading branch information
rickyma authored Jan 15, 2024
1 parent ad9fddd commit 3180501
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 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 @@ -82,8 +82,18 @@ public static <T> T retryWithCondition(
} catch (Throwable t) {
retry++;
if (isRetryFunc.apply(t) && retry < retryTimes) {
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,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 3180501

Please sign in to comment.