Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover from disconnected SSH tunnel #1084

Closed
istreeter opened this issue Sep 27, 2022 · 0 comments
Closed

Recover from disconnected SSH tunnel #1084

istreeter opened this issue Sep 27, 2022 · 0 comments

Comments

@istreeter
Copy link
Contributor

The loader opens a SSH tunnel immediately when it first starts up, and keeps the tunnel open indefinitely until the app terminates. But it's possible for the session to get disconnected, and the loader never discovers it has been disconnected.

This appears in the logs first of all like this:

INFO JCsh: Caught an exception, leaving main loop due to Connection reset
INFO JCsh: Disconnecting from port 22

And later lots and lots of messages like this:

ERROR Loader: Loading of <S3_URL> has failed. Adding intro retry queue. HikariPool-1 - Connection is not available, request timed out after 30001ms.

The underlying reason comes from these lines in the jcraft lib. Any exception on the socket is caught and handled and not raised to the application.

I suggest two fixes:

  1. We should call session.setServerAliveInterval described here, which should make it much less likely that the tunnel gets disconnected.
  2. When initiating the session, we should also start a fiber to periodically check session.isConnected.

I haven't worked out yet what action it should take if the session is disconnect: either restore the session, or raise an exception to crash the app. The former is more preferable if it works, but we should check that the JDBC connection recovers once the session is restored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant