[Twisted-Python] Signalling twistd with SIGUSR1 to rotate also interrupts txAMQP connections

Lucas Taylor ltaylor.volks at gmail.com
Fri Jan 15 13:01:44 EST 2010


On 1/13/10 1:00 PM, Anthony wrote:
> We run some services that use txAMQP within twistd to connect to an AMQP
> bus.
> 
> When we send twistd a SIGUSR1 to rotate its logs, it appears our
> application loses connection to the AMQP bus and needs to reconnect.
> This doesn't crash the app, but means the app may be offline momentarily
> when it should be available to process data.
> 
> Is it possible that twistd is processing the SIGUSR1 and then passing it
> onto our app and txAMQP?
> 
> We want to be able to force a log rotate without the entire app, or the
> connections it has open, resetting.
> 

AFAICT, twistd just registers a signal handler for SIGUSR1 that calls
t.p.logfile.Logfile.rotate. I don't see it propagating anywhere else in
a manner that would cause dropped connections.

Maybe os operations in rotate are blocking while they are doing the
remove/rename dance? Are you infrequently rotating (large files)?

If you setup your own handler for SIGUSR1, twistd will not register the
log rotation function, giving you an alternative to explore the issue.





More information about the Twisted-Python mailing list