You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2022/05/12 02:35:23 UTC
[iotdb] branch xingtanzjr/0511_test updated: fix bug
This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a commit to branch xingtanzjr/0511_test
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/xingtanzjr/0511_test by this push:
new 66ab6be9c7 fix bug
66ab6be9c7 is described below
commit 66ab6be9c7bbdec1e8cd1a17f9cb5160fd9388b9
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Thu May 12 10:35:13 2022 +0800
fix bug
---
.../sync/SyncThriftClientWithErrorHandler.java | 50 ++++++++++++----------
1 file changed, 27 insertions(+), 23 deletions(-)
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/client/sync/SyncThriftClientWithErrorHandler.java b/node-commons/src/main/java/org/apache/iotdb/commons/client/sync/SyncThriftClientWithErrorHandler.java
index c726e0bf03..ef1c9643a0 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/client/sync/SyncThriftClientWithErrorHandler.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/client/sync/SyncThriftClientWithErrorHandler.java
@@ -52,40 +52,44 @@ public class SyncThriftClientWithErrorHandler implements MethodInterceptor {
throws Throwable {
try {
return methodProxy.invokeSuper(o, objects);
- } catch (Throwable t1) {
- Throwable t = t1;
+ } catch (Throwable t) {
+ Throwable origin = t;
if (t instanceof InvocationTargetException) {
- t = ((InvocationTargetException) t).getTargetException();
+ origin = ((InvocationTargetException) t).getTargetException();
}
-
- if (t instanceof TException) {
+ Throwable cur = origin;
+ if (cur instanceof TException) {
int level = 0;
- while (t != null) {
+ while (cur != null) {
LOGGER.error(
"level-{} Exception class {}, message {}",
level,
- t.getClass().getName(),
- t.getMessage());
- t = t.getCause();
+ cur.getClass().getName(),
+ cur.getMessage());
+ cur = cur.getCause();
+ level++;
}
((SyncThriftClient) o).invalidate();
}
- Throwable rootCause = ExceptionUtils.getRootCause(t);
- // if the exception is SocketException and its error message is Broken pipe, it means that
- // the remote node may restart and all the connection we cached before should be cleared.
- LOGGER.error(
- "root cause message {}, LocalizedMessage {}, ",
- rootCause.getMessage(),
- rootCause.getLocalizedMessage(),
- rootCause);
- if (rootCause instanceof SocketException && rootCause.getMessage().contains("Broken pipe")) {
+ Throwable rootCause = ExceptionUtils.getRootCause(origin);
+ if (rootCause != null) {
+ // if the exception is SocketException and its error message is Broken pipe, it means that
+ // the remote node may restart and all the connection we cached before should be cleared.
LOGGER.error(
- "Broken pipe error happened in calling method {}, we need to clear all previous cached connection, err: {}",
- method.getName(),
- t);
- ((SyncThriftClient) o).invalidate();
- ((SyncThriftClient) o).invalidateAll();
+ "root cause message {}, LocalizedMessage {}, ",
+ rootCause.getMessage(),
+ rootCause.getLocalizedMessage(),
+ rootCause);
+ if (rootCause instanceof SocketException
+ && rootCause.getMessage().contains("Broken pipe")) {
+ LOGGER.error(
+ "Broken pipe error happened in calling method {}, we need to clear all previous cached connection, err: {}",
+ method.getName(),
+ t);
+ ((SyncThriftClient) o).invalidate();
+ ((SyncThriftClient) o).invalidateAll();
+ }
}
throw new TException("Error in calling method " + method.getName(), t);
}