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

Recovering disconnected sessions #51

Open
adatum opened this issue Jun 2, 2019 · 4 comments
Open

Recovering disconnected sessions #51

adatum opened this issue Jun 2, 2019 · 4 comments

Comments

@adatum
Copy link

adatum commented Jun 2, 2019

Is it possible to reconnect with an R session on the server after the client has lost connection? This could be due to network issues or simply for having the ability to put the client on standby while a task is run on the server.

As per the documentation, this works to connect and tunnel over SSH:

ssh -p XXXXX USER@SERVER -L 55556:localhost:55555 'Rscript -e "remoter::server(port=55555)"'

However, if disconnected, R continues to run on the server indefinitely, and running the above command again creates a new R process.

Ideally, a solution would:

  • allow disconnecting and reconnecting to the same R session
  • not kill or stop tasks running on the server
  • be possible to do with SSH tunnelling, without needing to open ports

I thought of trying something with mosh or et but I have not yet succeeded. mosh cannot do port forwarding/tunnelling. Also, both require opening ports.

Any ideas?

Thanks for making this great package!

@wrathematics
Copy link
Member

If you just want to restart the tunnel, but not the server itself, you could use the -N flag in ssh:

ssh -N -p XXXXX USER@SERVER -L 55556:localhost:55555

Then you should be able to reconnect in your local R session via remoter::client()

@adatum
Copy link
Author

adatum commented Jun 4, 2019

Could the disconnection and/or reconnection between the server and client cause issues with running tasks?

@wrathematics
Copy link
Member

Not sure I understand your question. The task will keep running regardless of whether or not the client is connected. If you try to reconnect while something is running on the server, it will appear to just hang. There could potentially be issues with reconnecting if the server is launched with secure=TRUE due to how keys are handled.

@adatum
Copy link
Author

adatum commented Jun 6, 2019

I'm trying to understand how the server and client will behave in different disconnection and reconnection scenarios, how that would affect running tasks, and whether it would result in lost work/time.

If you try to reconnect while something is running on the server, it will appear to just hang.

Will it hang permanently, or recover once the task has completed?

There could potentially be issues with reconnecting if the server is launched with secure=TRUE due to how keys are handled.

Any workarounds?


Is remoter appropriate for the use case of running tasks on a server from a laptop client which may have a flaky network connection, may roam networks, or might be put to sleep and later woken up to check on tasks?

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

2 participants