carletes / mock-ssh-server

Python mock SSH server for testing purposes
MIT License
56 stars 32 forks source link

Fixes an occasional deadlock #4

Closed mvdbeek closed 7 years ago

mvdbeek commented 7 years ago

I encountered an occasional deadlock when I was attempting to use mockssh using a real openssh client. I have observed that self.command_queues[channel.chanid].get(block=True) would block indefinitely and that the root of the problem appears to be that the self.command_queues dictionary would be filled with the same key multiple times. Just checking if the key already exists solved the deadlock problem for me (but I'm not sure this is a good solution).

I have included a unit test in 6a3025c that demonstrates this problem (I am running the test 5 times, since the problem does not always occur), if you revert 0dee748 the test should fail.

I am hoping you can include this PR or use the test case to find a better solution, as I would love to include MockSSH into another project for unit testing.

carletes commented 7 years ago

Thanks, @mvdbee! Merging now.

mvdbeek commented 7 years ago

Thanks a lot @carletes for the rapid review and merge! Can I also ask you to publish a new release to PyPI when you have some time ?

carletes commented 7 years ago

Can I also ask you to publish a new release to PyPI when you have some time?

Yep, I'll get to to it in the next few days.