当与gevent一起使用时,socket.getaddrinfo()会永远阻塞 [英] socket.getaddrinfo() block forever when using with gevent

查看:254
本文介绍了当与gevent一起使用时,socket.getaddrinfo()会永远阻塞的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用httplib2,我用gevent发送多个请求,一段时间后http.request()http.request()方法被永远阻止.
经过检查,我发现阻塞功能在httplib2中的socket.getaddrinfo() 链接.

Using httplib2, I am sending multiple requests with gevent, after some time http.request() method of httplib2 is getting blocked forever.
On checking I found that blocking function is socket.getaddrinfo() in httplib2 link.

推荐答案

使用socket.setdefaulttimeout()设置默认超时.由于未指定getaddrinfo的超时,它将使用默认超时.

set default timeout using socket.setdefaulttimeout(). since timeout of getaddrinfo is not specified it will use default timeout.

这篇关于当与gevent一起使用时,socket.getaddrinfo()会永远阻塞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆