remoter
remoter copied to clipboard
Recovering disconnected sessions
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!
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()
Could the disconnection and/or reconnection between the server and client cause issues with running tasks?
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.
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?