关闭与twisted的连接
各种连接 - 例如使用 twisted 创建的连接。 web.client.getPage()
似乎泄漏 - 它们会无限期地挂起,因为操作系统超时以小时为单位 - 如果服务器没有及时响应。在您返回的延迟上设置超时已被弃用。
如何在扭曲的程序中跟踪已打开的请求并强制关闭它们?
(强制关闭应用程序逻辑中超时的连接对于构建可扩展的扭曲服务器非常重要;各种反应器对它们允许的打开文件描述符的数量有不同的限制 - select
低至 1024所以请帮助扭曲的用户保持良好的开放连接数并进行修剪。)
Various connections - e.g. those created with twisted.web.client.getPage()
seem to leak - they hang around indefinitely, since the OS time-out is measured in hours - if the server doesn't respond timely. And putting a time-out on the deferred you get back is deprecated.
How can you track the requests you have open, and close them forcefully in your twisted program?
(Forcefully closing connections that have timed-out in application logic is important to making a twisted server that scales; various reactors have different limits on the number of open file descriptors they allow - select
being as low as 1024! So please help twisted users keep the open connections count nice and trimmed.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
getPage
接受timeout
参数。如果您为其传递一个值,但在该秒数内未完全接收到响应,则连接将关闭,并且getPage
返回的Deferred
将发生错误返回。getPage
accepts atimeout
parameter. If you pass a value for it and the response is not fully received within that number of seconds, the connection will be closed and theDeferred
returned bygetPage
will errback.