odd timeouts on socket.connect

49 views
Skip to first unread message

Johan Rydberg

unread,
Aug 16, 2012, 1:02:41 PM8/16/12
to gev...@googlegroups.com
Hi,

I'm running into quite an odd situation.

I'm using geventhttpclient to fetch content from a remote web server.
Everything works
fine, and then I stop the web server. I start to get "connection
refused", as expected.

But when I start up the web server again, instead of the client
managing to fetch content
it gets socket.timeout's.

I've tried to reproduce it outside my application, without success.

Looking at some "strace" output it seems as if we do NOT get any
timeout, not at least
on that operation:

18:51:53.345026 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 44
18:51:53.345157 fcntl(44, F_GETFL) = 0x2 (flags O_RDWR)
18:51:53.345249 fcntl(44, F_SETFL, O_RDWR|O_NONBLOCK) = 0
18:51:53.345433 getsockopt(44, SOL_SOCKET, SO_ERROR, [0], [4]) =
018:51:53.345540 connect(44, {sa_family=AF_INET,
sin_port=htons(13100), sin_addr=inet_addr("10.16.63.113")}, 16) = -1
EINPROGRESS (Operation now in progress)
18:51:53.345879 epoll_ctl(6, EPOLL_CTL_ADD, 44, {EPOLLOUT, {u32=44,
u64=44}}) = 0
18:51:53.346008 epoll_wait(6, {{EPOLLOUT, {u32=44, u64=44}}}, 32, 493) = 1
18:51:53.346214 epoll_ctl(6, EPOLL_CTL_DEL, 44, {EPOLLOUT, {u32=44,
u64=44}}) = 0
18:51:53.346496 prctl(PR_SET_NAME, 0x7fffc0a3241a, 0x2d, 0x7,
0x7fffc0a3241a) = 0
18:51:53.346496 prctl(PR_SET_NAME, 0x7fffc0a3241a, 0x2d, 0x7,
0x7fffc0a3241a) = 0
18:51:53.346596 getppid() = 3753
18:51:53.346687 fchmod(5, 0) = 0
18:51:53.347016 write(19, "\0", 1) = 1
18:51:53.347348 write(19, "\0", 1) = 1

We're getting some kind of event on FD 44, not sure what it is though.

When this is called:

wait_readwrite(sock.fileno(), timeout=timeleft,
event=self._rw_event)

is timeleft 4.999

Sometimes, _SOMETIMES_, things to start to work again after a while. But that's
not very often. (last time it got going after 5 minutes).

Anyone got any idea what can be going on?

This is gevent 0.13.7
Reply all
Reply to author
Forward
0 new messages