[Twisted-Python] application shutdown and control-C

glyph at divmod.com glyph at divmod.com
Thu Sep 15 15:52:32 MDT 2005



On Thu, 15 Sep 2005 11:54:52 -0700 (PDT), Antony Kummel <antonykummel at yahoo.com> wrote:

>When running an application on Windows with twistd,
>and stopping it with Control-C, sometimes it shuts
>down properly, and sometimes it just stops abruptly,
>which also means it doesn't get written to
>*-shutdown.tap. That's no good! Has anyone experienced
>this before?

Yep, and I spent about a week trying to fix it, once.  I couldn't really figure it out, but I came away with the impression that there isn't *really* such a thing as "signal()" on Windows - programs don't habitually send signals or handle them, especially when sent by hitting C-c in a CMD window - which appears to be subtly different from programmatically sending it.

Cygwin utilities appear to have the same issue; on 1 out of 100 runs (for me, anyway), C-c'ing a hosed process will terminate it instantly with no cleanup.  Also, command-line Python will usually generate a KeyboardInterrupt, but sometimes just exit immediately.  The busier it is, the more likely to just die (it seems) but I have never managed a direct correlation.

Terminating any reactor normally on Windows, with .stop(), works fine, though.




More information about the Twisted-Python mailing list