internap / virtualpdu

A virtual power distribution unit (PDU) for controlling libvirt virtual machines via SNMP commands.
Apache License 2.0
3 stars 6 forks source link

Handle SIGINT correctly on Python 2.7 #20

Closed idjaw closed 8 years ago

idjaw commented 8 years ago

This fix helps resolve currently breaking builds due to an issue with timeouts happening when starting the SNMP PDU Harness. Furthermore, work has been done here to help deal with hanging threads in py27

JoProvost commented 8 years ago

Am I right saying that this pull request include changes of #18 and closes issues #14 and #16?

JoProvost commented 8 years ago

I say :+1: If the while t.isAlive(): t.join(1) can be replaced for t.join() I would prefer this.

mat128 commented 8 years ago

JoProvost: if you did that, the KeyboardException will never be found because the main thread will be "stuck" doing "join". With that, we have a <=1s response time to SIGINT. Additionally, we have a test covering this case.

By the way, just joining worked on py3, but py2 required us to do that workaround.

mat128 commented 8 years ago

And yes, Wajdi included the code from the other PR in here (so that PR doesnt have the right title anymore, because it's bringing other code in)

mat128 commented 8 years ago

/me hates github, if this was gerrit I could have updated wajdi's commit, or he could have updated mine.

mat128 commented 8 years ago

@idjaw: If you could change the commit message to something like that:

Handle SIGINT correctly on Python 2.7
Currently, VirtualPDU is unstoppable on Python 2.7. Correct this by
handling KeyboardInterrupt events in the main thread.

Closes issues #14 and #16
JoProvost commented 8 years ago

I strongly put :+1:

mat128 commented 8 years ago

lgtm besides the retry/retrying requirement.