Skip to content

Commit

Permalink
cells: always try to re-establish dead tunnel, unless stopped
Browse files Browse the repository at this point in the history
Motivation:
As long as cell tunnel is not explicitly stopped by calling
dmg.cells.network.LocationManagerConnector#stopped, other interrupts
should be ignored.

Modification:
Update retry logic to never give up, unless _isRunning flag set to
false.

Result:
More robust tulles in case of network issues.

Issue: #7707, #5326
Acked-by: Dmitry Litvintsev
Target: master, 10.2, 10.1, 10.0, 9.2
Require-book: no
Require-notes: yes
(cherry picked from commit 600ed1f)
Signed-off-by: Tigran Mkrtchyan <[email protected]>
  • Loading branch information
kofemann committed Dec 6, 2024
1 parent 48d312b commit 5eec1d8
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ public void run() {
} finally {
getNucleus().kill(tunnel.getCellName());
}
} catch (InterruptedIOException | ClosedByInterruptException e) {
throw e;
} catch (InterruptedIOException | InterruptedException | ClosedByInterruptException e) {
_log.warn("Connection to {} ({}) interrupted. Reason: {}", _domain, _address, e.toString());
} catch (ExecutionException | IOException e) {
String error = Exceptions.meaningfulMessage(Throwables.getRootCause(e));
_log.warn(AlarmMarkerFactory.getMarker(PredefinedAlarm.LOCATION_MANAGER_FAILURE,
Expand All @@ -116,11 +116,16 @@ public void run() {
_status = "Sleeping";
long sleep = random.nextInt(16000) + 4000;
_log.warn("Sleeping {} seconds", sleep / 1000);
Thread.sleep(sleep);
try {
Thread.sleep(sleep);
} catch (InterruptedException e) {
// restore interrupted status
Thread.currentThread().interrupt();
}
}
} catch (InterruptedIOException | InterruptedException | ClosedByInterruptException ignored) {
} finally {
NDC.pop();
_thread = null;
_status = "Terminated";
}
}
Expand Down

0 comments on commit 5eec1d8

Please sign in to comment.