You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by al...@apache.org on 2022/12/09 06:25:02 UTC
[ignite] branch master updated: IGNITE-18307 Fix long wait on locHost.isReachable - Fixes #10415.
This is an automated email from the ASF dual-hosted git repository.
alexpl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 781abc70c1e IGNITE-18307 Fix long wait on locHost.isReachable - Fixes #10415.
781abc70c1e is described below
commit 781abc70c1e46f472c3bab552b35c02155e92a41
Author: Aleksey Plekhanov <pl...@gmail.com>
AuthorDate: Fri Dec 9 09:22:14 2022 +0300
IGNITE-18307 Fix long wait on locHost.isReachable - Fixes #10415.
Signed-off-by: Aleksey Plekhanov <pl...@gmail.com>
---
.../src/main/java/org/apache/ignite/internal/GridDiagnostic.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridDiagnostic.java b/modules/core/src/main/java/org/apache/ignite/internal/GridDiagnostic.java
index f0c17082e28..6b63972346c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridDiagnostic.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridDiagnostic.java
@@ -22,6 +22,7 @@ import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -35,6 +36,9 @@ final class GridDiagnostic {
/** */
private static final int REACH_TIMEOUT = 2000;
+ /** Check local host reachability and print warning only once per JVM instance. */
+ private static final AtomicBoolean locHostChecked = new AtomicBoolean();
+
/**
* Ensure singleton.
*/
@@ -59,7 +63,7 @@ final class GridDiagnostic {
try {
InetAddress locHost = U.getLocalHost();
- if (!locHost.isReachable(REACH_TIMEOUT)) {
+ if (locHostChecked.compareAndSet(false, true) && !locHost.isReachable(REACH_TIMEOUT)) {
U.warn(log, "Default local host is unreachable. This may lead to delays on " +
"grid network operations. Check your OS network setting to correct it.");
}