Dirk Meyer wrote:
> Duncan Webb wrote:
>> Traceback (most recent call last):
>>   File
>> "/usr/lib/python2.4/site-packages/freevo/helpers/recordserver.py", line
>> 1748, in ?
>>     main()
>>   File
>> "/usr/lib/python2.4/site-packages/freevo/helpers/recordserver.py", line
>> 1730, in main
>>     reactor.run()
>>   File "/usr/lib/python2.4/site-packages/twisted/internet/posixbase.py",
>> line 218, in run
>>     self.mainLoop()
>> --- <exception caught here> ---
>>   File "/usr/lib/python2.4/site-packages/twisted/internet/posixbase.py",
>> line 229, in mainLoop
>>     self.doIteration(t)
>>   File
>> "/usr/lib/python2.4/site-packages/twisted/internet/selectreactor.py",
>> line 97, in doSelect
>>     [], timeout)
>>   File "/usr/lib/python2.4/site-packages/kaa/notifier/__init__.py", line
>> 190, in signal_handler
>>     sys.exit(0)
>> exceptions.SystemExit: 0
>>
>> Seems that sys.exit causes an un-trapped exception in notifier.
> 
> Not in the notifier, only in twisted. So we have to remove the signal
> handler when using twisted somehow. Dies it work when signal_handler
> in __init__ just does nothing?

You mean like this:
# catch SIGTERM and SIGINT if possible for a clean shutdown
if threading.enumerate()[0] == threading.currentThread():
    def signal_handler(*args):
        #sys.exit(0)
        pass
    signal.signal(signal.SIGTERM, signal_handler)
    signal.signal(signal.SIGINT, signal_handler)
else:
    log.info('kaa imported from thread, disable SIGTERM handler')

It shuts down cleanly.

Duncan


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to