sonyxperiadev / pygerrit

MIT License
52 stars 51 forks source link

Command execution error: Channel closed when running a query #27

Closed naiquevin closed 9 years ago

naiquevin commented 9 years ago

I am consistently getting this error when running a gerrit query using GerritClient.query method

pygerrit.error.GerritError: Command execution error: Channel closed.

The interesting thing is, this happens when connecting to a gerrit server running inside a VM on my laptop. But I can't reproduce it even once when connecting to our actual gerrit server.

I also found this old thread on paramiko launchpad - https://bugs.launchpad.net/paramiko/+bug/413850 but not sure how relevant this could be considering it's about 6 years old.

Full Stacktrace:

Traceback (most recent call last):
  File "/Users/naiquevin/.virtualenvs/catapult/bin/catapult", line 9, in <module>
    load_entry_point('catapult==0.1.0', 'console_scripts', 'catapult')()
  File "/Users/naiquevin/helpshift/code/catapult/catapult/commands/__init__.py", line 21, in main
    cli.cli(obj={})
  File "/Users/naiquevin/.virtualenvs/catapult/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/Users/naiquevin/.virtualenvs/catapult/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/Users/naiquevin/.virtualenvs/catapult/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/naiquevin/.virtualenvs/catapult/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/naiquevin/.virtualenvs/catapult/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/Users/naiquevin/helpshift/code/catapult/catapult/commands/merge_branches.py", line 54, in merge_branches
    assert not gerrit.is_branch_open(gc, project, target_branch)
  File "/Users/naiquevin/helpshift/code/catapult/catapult/gerrit.py", line 232, in is_branch_open
    'status': 'open'})
  File "/Users/naiquevin/helpshift/code/catapult/catapult/gerrit.py", line 106, in query
    return client.query(qs)
  File "/Users/naiquevin/.virtualenvs/catapult/src/pygerrit/pygerrit/client.py", line 106, in query
    result = self._ssh_client.run_gerrit_command(" ".join(command))
  File "/Users/naiquevin/.virtualenvs/catapult/src/pygerrit/pygerrit/ssh.py", line 190, in run_gerrit_command
    raise GerritError("Command execution error: %s" % err)
pygerrit.error.GerritError: Command execution error: Channel closed.
naiquevin commented 9 years ago

This seems to an issue with the underlying paramiko library and not pygerrit itself. Another interesting thing is that the problem can only be reproduced with a query that would empty results (0 commits).

I am planning to debug this further by going through the paramiko source code. Feel free to close this issue.

dpursehouse commented 9 years ago

Thanks for following up. If this gets fixed in paramiko we an update the version used in pygerrit.