Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm remote processes finish when connection breaks

I am running a project using a remote interpreter using an SSH connection (PyCharm professional 2016.3.3). When I have a connection everything works fine, but if my connection gets interrupted (either I accidentally close the laptop lid, enter sleep mode, or the wifi connection breaks momentarily for some unknown reason) then when I reconnect, my console session is terminated with Process finished with exit code -1.

The output from the interactive console reads:

ssh://username@remote_server:22/usr/bin/python /home/some_path/.pycharm_helpers/pydev/pydevconsole.py 0 0
PyDev console: using IPython 5.1.0
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
>>> a = 1
>>> # At this point I break the connection and then re-establish it after about 1 min. 
Process finished with exit code -1

In this example I disabled wifi, and then re-enabled, connecting to a different wifi source, and then connected back to the orignal wifi source. This happens moderately frequently (maybe once daily) and can be a real hindrance.

Is there perhaps a setting I can change to avoid this, or is there a more robust connection method to attach the console to the process running on the remote host? The ideal situation would be one where if I lost my connection with one wifi source and opened a connection with another then my process would not be killed.

NB - It is important that I can have an interactive session, as my work is research based and I would need to be able to interactively write and run code.

like image 250
oliversm Avatar asked Sep 06 '17 09:09

oliversm


People also ask

How do I debug in PyCharm remotely?

Remote Debugging with PyCharm. With PyCharm you can debug your application using an interpreter that is located on the other computer, for example, on a web server or dedicated test machine. PyCharm provides two ways to debug remotely: Through a remote interpreter.

What does waiting for process connection mean in PyCharm?

Waiting for process connection... When stopping the remote application with CTRL-C the stdout/stderr is nonetheless transmitted to PyCharm and appears in the debug console: Waiting for process connection... Server stopped. Like if the connection was opened and closed at the same time.

What is the difference between PyCharm debug server and remote interpreter?

In order to debug with a remote interpreter, you have to start your program through PyCharm, which is not always possible. On the other hand, when using the Debug Server, you can connect to a running process. Compare the two approaches.

Does PyCharm automatically push changes to the same remote host?

However, when I change code, changes do get automatically pushed toward this same remote host with no problem. I can also browse to the virtual environment on the remote host (through PyCharm).


1 Answers

I am also looking for a solution to this problem. The only workaround that I can think of for now is to set the keep alive message interval to a very high value under Tools>Deployment>Configuration>Advance Options. Maybe this solves the problem that the process finishes (But I couldn't test this yet).

like image 95
Marcel_marcel1991 Avatar answered Nov 01 '22 03:11

Marcel_marcel1991