https://bugzilla.wikimedia.org/show_bug.cgi?id=55127
--- Comment #10 from Merlijn van Deen valhallasw@arctus.nl --- Minimal test case for the SSL issue:
import httplib2
h = httplib2.Http() resp, content = h.request("https://en.wikipedia.org/", "GET") raw_input("kill the connection...") resp, content = h.request("https://en.wikipedia.org/", "GET") print "done"
So there are three issues: - A connection can hang indefinitely if the connection is killed. There should be some timeout for receiving some data here. - The framework does not respond to ctrl-c when a thread doesn't return. This can be solved by changing pywikibot/comms/http.py to be non-blocking (e.g. in a loop with a 100ms time.sleep) - Threads do not receive KeyboardInterrupts (which is OK!) but this means a non-returning call will hang forever (i.e. will not be killed when python exits)
Amirs solution might be useful for the last issue, but I'm not 100% sure about that. I think I'd rather hook the atexit handler to kill all processing threads. Maybe we can also start threads as daemons, which should kill them automatically when the main thread exits...