thingalon / pony-ssh

vscode plugin for fast remote editing over ssh
MIT License
31 stars 4 forks source link

Unexpected end of worker channel #7

Closed jhfoo closed 4 years ago

jhfoo commented 4 years ago

Environment VS Code on Windows 10 trying to connect to FreeBSD 12.0. Connecting using private key file.

Error Unable trying to connect to remote host. Logs below:

[2019-12-15 02:02:58] [info] Connection established
[2019-12-15 02:02:58] [info] Preparing worker script
[2019-12-15 02:02:58] [info] Worker script ok
[2019-12-15 02:02:58] [info] Opening workers
[2019-12-15 02:02:58] [info] Remote home directory: /home/jhfoo/
[2019-12-15 02:02:58] [info] Connected to jack
[2019-12-15 02:02:58] [warn] Channel STDERR output: <Buffer 54 72 61 63 65 62 61 63 6b 20 28 6d 6f 73 74 20 72 65 63 65 6e 74 20 63 61 6c 6c 20 6c 61 73 74 29 3a 0a 20 20 46 69 6c 65 20 22 2f 68 6f 6d 65 2f 6a ... 825 more bytes>
[2019-12-15 02:02:58] [error] Connection error: Unexpected end of worker channel
[2019-12-15 02:02:58] [error] Connection error: Unexpected end of worker channel
[2019-12-15 02:02:58] [error] Connection error: Unexpected end of worker channel

Tested Same failure on Python 2.7, 3.6, 3.7.

thingalon commented 4 years ago

Hi @jhfoo!

Thanks for the bug report, and thank you for testing it so thoroughly.

It looks like PonySSH is not outputting errors in a useful / meaningful way. The following line contains the beginning of an error message that would help diagnose the problem, but it's hex-encoded and truncated:

[2019-12-15 02:02:58] [warn] Channel STDERR output: <Buffer 54 72 61 63 65 62 61 63 6b 20 28 6d 6f 73 74 20 72 65 63 65 6e 74 20 63 61 6c 6c 20 6c 61 73 74 29 3a 0a 20 20 46 69 6c 65 20 22 2f 68 6f 6d 65 2f 6a ... 825 more bytes>

I've just released Pony SSH 0.3.0 with some updates to ensure that error messages are properly output in plaintext (and in full).

Please give the new version a try. I don't think it will fix the connection problem, but hopefully it will output a more useful error message so that we can sort out what's gone wrong. :)

thingalon commented 4 years ago

Closing due to inactivity.

choujar commented 4 years ago

`[2020-05-21 08:39:40] [info] Connection established [2020-05-21 08:39:40] [info] Preparing worker script [2020-05-21 08:39:40] [info] Worker script ok [2020-05-21 08:39:40] [info] Opening workers [2020-05-21 08:39:41] [warn] Channel STDERR output: Traceback (most recent call last):

[2020-05-21 08:39:41] [warn] Channel STDERR output: File "/usr/lib64/python2.6/runpy.py", line 122, in _run_module_as_main

[2020-05-21 08:39:41] [warn] Channel STDERR output: "main", fname, loader, pkg_name)

[2020-05-21 08:39:41] [warn] Channel STDERR output: File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code

[2020-05-21 08:39:41] [warn] Channel STDERR output: exec code in run_globals

[2020-05-21 08:39:41] [warn] Channel STDERR output: File "/home/everyt12/.pony-ssh/worker.zip/main.py", line 10, in

[2020-05-21 08:39:41] [warn] Channel STDERR output: File " [2020-05-21 08:39:41] [warn] Channel STDERR output: /home/everyt12/.pony-ssh/worker.zip/watcher.py [2020-05-21 08:39:41] [warn] Channel STDERR output: ", line [2020-05-21 08:39:41] [warn] Channel STDERR output: 141 [2020-05-21 08:39:41] [warn] Channel STDERR output: path:self.process_change_type(watch_mask) for (path,watch_mask) in paths.items()

[2020-05-21 08:39:41] [warn] Channel STDERR output: ^

[2020-05-21 08:39:41] [warn] Channel STDERR output: SyntaxError [2020-05-21 08:39:41] [warn] Channel STDERR output: : [2020-05-21 08:39:41] [warn] Channel STDERR output: invalid syntax [2020-05-21 08:39:41] [error] Connection error: Unexpected end of worker channel`

Hi @thingalon, I'm getting the same problem - the error is listed above... Any thoughts?

thingalon commented 4 years ago

Hi @choujar.

The problem is that your target system is running Python 2.6. Pony-SSH requires Python 2.7+ on the remote system.

You will need to upgrade Python on the server you are connecting to in order to use Pony SSH.

If your server has multiple versions of python installed, you can specify which to use by adding: "python": "/full/path/to/your/python/version" to your host configuration block in your settings.json. eg:

"ponyssh.hosts": { 
    "my-host": {
       "host": "my-host.example.com",
       "username": "my-login",
       "password": true,
       "python": "/usr/lib64/python2.7/bin/python",
    },
}

(Of course, update the value of python to reflect where its executable is on your remote host)