Pyro 信号安全吗?
我已经使用 Pyro 3 一段时间了,取得了巨大的成功,但偶尔我注意到,当 Pyro 正在进行一些远程通信时,当 SIGHUP 或 SIGINT 等信号到达时,进程会挂起,因此问题是 Pyro信号安全吗?
提前致谢。
I have been using Pyro 3 for a little while now, with great success, but occasionally I have noticed, that when a signal such as SIGHUP or SIGINT arrives while Pyro is doing some remote communications, the process hangs, hence the question, is Pyro signal safe?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来这里的问题是默认情况下 Python 设置了 SIGINT 和 SIGTERM 的处理程序,这会引发异常。如果您在执行一些 Pyro 通信时收到信号,则会引发异常,并且它会去寻找适当的 except 子句,而不是完成它正在做的事情,如果您随后尝试再次使用 Pyro,例如在 except 中/finally 子句,你可能会遇到问题。就我而言,它通过队列将一些消息从 finally 发送到日志,该队列使用 Pyro 代理到另一个进程。
Seems the issue here is by default Python sets up a handlers for SIGINT and SIGTERM which raise exceptions. If you therfore receive a signal while doing some Pyro comms, the exception is raised, and off it goes to look for an appropriate except clause, not finishing what it was doing, if you then try and use Pyro again, for example in the except/finally clause, you can get issues. In my case it was sending some messages from finally to a log via a queue which was proxied to another process using Pyro.