lordmauve / chopsticks

Chopsticks is an orchestration library: it lets you execute Python code on remote hosts over SSH.
https://chopsticks.readthedocs.io/
Apache License 2.0
158 stars 16 forks source link

Crashes during loop execution can leave a tunnel in a bad state #22

Closed lordmauve closed 7 years ago

lordmauve commented 7 years ago

Using loop.stop() to pass a result back to the calling thread can result in losing sync if the loop has previously crashed somehow.

I was able to get the following code:

print('num_users', tun.call(num_users))
print('getpass', tun.call(getpass.getuser))

to produce this output:

shadow_users root
getpass 40

This can be fixed by clearing the Tunnel's callbacks if the loop crashes. However, better would be to actually tie back the request ID to the response being waited for, and only terminate the loop if it matches.

lordmauve commented 7 years ago

This was fixed over the last couple of commits.