From 9ef9be3aca32e4c202d667b9b7303975163a8303 Mon Sep 17 00:00:00 2001 From: Victor Pickard Date: Thu, 23 Aug 2018 13:09:13 -0400 Subject: [PATCH] Close old OVSDB connection when ping fails When rebooting a compute node, the ovsdb hostconfig is missing from oper d/s. The change resolves the issue, by closing the connection if the ping/echo fails. The ping/echo is triggered when a new connection comes in. What was happening before this change, is that the new connection from the rebooted compute node would be rejected and closed, because the code saw an existing connection, and had not yet "closed" the old connection, which would fail later, about 3 seconds later. Tested this with queens/oxygen by manually rebooting compute node (sudo shutdown -r now) a number of times. Many more details in the JIRA. JIRA: OVSDB-444 Change-Id: I0c7e53b032fd53d0287bc28ae86f7ebda06cfabe Signed-off-by: Victor Pickard --- .../ovsdb/lib/impl/StalePassiveConnectionService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/StalePassiveConnectionService.java b/library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/StalePassiveConnectionService.java index 68090b6b5..f5b8fd672 100644 --- a/library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/StalePassiveConnectionService.java +++ b/library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/StalePassiveConnectionService.java @@ -75,12 +75,15 @@ public class StalePassiveConnectionService implements AutoCloseable { @Override public void onSuccess(List result) { //old client still active - LOG.info("Echo testing of old client {} succeded", oldClient.getConnectionInfo()); + LOG.info("Echo testing of old client {} succeeded", oldClient.getConnectionInfo()); } @Override public void onFailure(Throwable throwable) { - LOG.info("Echo testing of old client {} failed", oldClient.getConnectionInfo()); + LOG.info("Echo testing of old client {} failed, disconnect and notify clients", + oldClient.getConnectionInfo()); + //disconnect the old client to cleanup, so that new connection can proceed + oldClient.disconnect(); onInactiveClient(oldClient); } }, MoreExecutors.directExecutor()); -- 2.36.6