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 2011.08.12 21:30:32 [warn] === evhttp_read_cb: fd: 142 len: 448: data: GET /query/xxx/yyy/ HTTP/1.0 <-- other headers --> \r\n\r\n 2011.08.12 21:30:32 [warn] === evhttp_read_firstline: fd: 142 2011.08.12 21:30:32 [warn] === evhttp_read_header: fd: 142 2011.08.12 21:30:32 [warn] === evhttp_get_body: fd: 142 2011.08.12 21:30:32 [warn] === evhttp_handle_request: fd: 142 2011.08.12 21:30:32 v[3] handler_input: id: 336215 2011.08.12 21:30:32 v[3] handler: id: 336215 ip: XX.XX.XX.XX remote: 127.0.0.1:49242 uri: /query/xxx/yyy/ 2011.08.12 21:30:32 [warn] === evhttp_write_buffer: fd: 142 preparing to write buffer 2011.08.12 21:30:32 v[3] handler_output: id: 336215 2011.08.12 21:30:32 [warn] === event_active: 0x802a84508 (fd: 142), res 4, callback 0x800796ea0 2011.08.12 21:30:32 [warn] === evhttp_write_cb: fd: 142 There is 30 seconds difference between evhttp_get_request_connection and event_active calls. Why? I wrote in my first message what tcpdump shows no troubles in network activity. So, if everything ok with network, where libevent or maybe OS (FreeBSD 7.2) holds request for 30 / 75 seconds? Should I insert debug output in some other important functions of libevent? Any help is welcome.