13

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.

oliversm
  • 1,771
  • 4
  • 22
  • 44
  • Did you find any solution to this? – Stiefel Nov 04 '19 at 16:35
  • @Stiefel not yet. – oliversm Nov 04 '19 at 16:51
  • Hi @oliversm, could you screenshot your remote debugger configuration? And your `Build, Execution, Deployment`=>`Deployment` configuration? In particular, did you change the default 300 seconds 'Send keep alive messages each:'? Do you have any idea how many times you stay offline when you get network issue? – Bsquare ℬℬ Nov 06 '19 at 09:39
  • @Bsquareℬℬ I'll see if I can dig out the project, but it's been a while.... – oliversm Nov 07 '19 at 11:17
  • It was not 2 days ago? – Bsquare ℬℬ Nov 07 '19 at 13:27
  • @Bsquareℬℬ question is nearly 2 years old. The project has since expired, but I'd nonetheless be keen to know a workaround for in the future. – oliversm Nov 07 '19 at 14:00
  • Ok, I'll try to help you if you give me more information ;) – Bsquare ℬℬ Nov 07 '19 at 14:20
  • 1
    Remote python console is not completely documented. Seems like @oliversm runs pydev console in client side (his I think), while there is configuration to run it as `mode=server`. For example this is what I get when I run remote console `ssh://root@192.168.1.1:22/usr/bin/python3.6 -u /root/.pycharm_helpers/pydev/pydevconsole.py --mode=server`. And when I disconnect and reconnect on my side, nothing happens. But if I stop remote machine, I get same error as he does. Also, interactive pydev console code is placed in `/home/user/.pycharm_helpers/pydev/pydevconsole.py `. – Dinko Pehar Nov 11 '19 at 10:32
  • 1
    Relevant ticker: https://youtrack.jetbrains.com/issue/PY-25514 – olejorgenb May 12 '21 at 07:12

1 Answers1

3

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).