[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Re: libevent http and lost requests



On Fri, Aug 12, 2011 at 11:36 PM, Mark Ellzey <mthomas@xxxxxxxxxx> wrote:
On Fri, Aug 12, 2011 at 09:48:20PM +0300, about bus wrote:
> I've added some debug output in libevent functions, added "fd" (file
> descriptor) in every output message.
> messages from libevent - [warn]
> messages from my http server - v[3]
> Also I've changed timeout in nginx config from 75 to 30, it does not
> increase or decrease timeouts count.
> I've got about 0.1% timeout errors independently from timeout value.
>
> Log output for one of timeouted requests:
>
> 2011.08.12 21:30:02 [warn] ===    evhttp_get_request_connection: fd: 142 new
> request from 127.0.0.1:49242
> 2011.08.12 21:30:32 [warn] ===    event_active: 0x802a84480 (fd: 142), res
> 2, callback 0x8007970f0

Hrmm - looks like DNS

evhttp_get_request_connection(
       struct evhttp* http,
       evutil_socket_t fd, struct sockaddr *sa, ev_socklen_t salen)
{
       struct evhttp_connection *evcon;
       char *hostname = NULL, *portname = NULL;

       name_from_addr(sa, salen, &hostname, &portname);


eventually calling gethostbyaddr().


My guess is that it can't resolve the address.

If this is the case, that's actually not the right thing to do (on
levent side).


I've checked this, domain name resolution does not take much time.
Issue somewhere between end of evhttp_socket_cb and start of evhttp_read_cb functions calls.

2011.08.14 16:52:27 [warn] ===  evhttp_socket_cb: fd: 131
2011.08.14 16:52:27 [warn] ===  evhttp_get_request_connection: fd: 131 new request from 127.0.0.1:53282
2011.08.14 16:52:27 [warn] ===  evhttp_get_request_connection [[before return]]: fd: 131 ### return from function
2011.08.14 16:52:27 [warn] ===  evhttp_start_read: fd: 131
2011.08.14 16:52:27 [warn] ===  evhttp_socket_cb [[before return]]: fd: 131 ### return from function
2011.08.14 16:52:57 [warn] ---  event_active: 0x803032390 (fd: 131), res 2, callback 0x800797140
2011.08.14 16:52:57 [warn] ===  evhttp_read_cb: fd: 131 len: 401: data: GET /qyery/xxx/yyy/ <-- headers --->