This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 40d02b9165 HDDS-12639. Add info for TimeoutException (#8113)
40d02b9165 is described below
commit 40d02b91658404a5262ee7142e6f6c0fc734bd53
Author: Symious <[email protected]>
AuthorDate: Thu Apr 3 21:16:18 2025 +0800
HDDS-12639. Add info for TimeoutException (#8113)
---
.../states/datanode/RunningDatanodeState.java | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/datanode/RunningDatanodeState.java
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/datanode/RunningDatanodeState.java
index 9f843864aa..e275430e3c 100644
---
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/datanode/RunningDatanodeState.java
+++
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/states/datanode/RunningDatanodeState.java
@@ -27,6 +27,7 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import org.apache.hadoop.hdds.conf.ConfigurationSource;
import
org.apache.hadoop.ozone.container.common.statemachine.DatanodeStateMachine;
import
org.apache.hadoop.ozone.container.common.statemachine.EndpointStateMachine;
@@ -97,9 +98,17 @@ public void execute(ExecutorService executor) {
} else {
heartbeatFrequency = context.getHeartbeatFrequency();
}
- ecs.submit(() -> endpoint.getExecutorService()
- .submit(endpointTask)
- .get(heartbeatFrequency, TimeUnit.MILLISECONDS));
+ ecs.submit(() -> {
+ try {
+ return endpoint.getExecutorService()
+ .submit(endpointTask)
+ .get(context.getHeartbeatFrequency(), TimeUnit.MILLISECONDS);
+ } catch (TimeoutException e) {
+ TimeoutException timeoutEx = new TimeoutException("Timeout
occurred on endpoint: " + endpoint.getAddress());
+ timeoutEx.initCause(e);
+ throw timeoutEx;
+ }
+ });
} else {
// This can happen if a task is taking more time than the timeOut
// specified for the task in await, and when it is completed the task
@@ -167,7 +176,12 @@ private Callable<EndPointStates> buildEndPointTask(
LOG.error("Error in executing end point task.", e);
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
- LOG.error("Error in executing end point task.", e);
+ Throwable cause = e.getCause();
+ if (cause instanceof TimeoutException) {
+ LOG.warn("Detected timeout: {}", cause.getMessage());
+ } else {
+ LOG.error("Error in executing end point task.", e);
+ }
}
}
return DatanodeStateMachine.DatanodeStates.RUNNING;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]