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

Re: [Libevent-users] Possible bug in http.c



On Mon, Apr 18, 2016 at 10:52:24AM -0400, Ronen Mizrahi wrote:
> Hi,
> 
> I was wondering if anyone had a chance to look into this patch?
>
> We recently upgraded to the latest stable release of libevent and it looks
> like the issue mentioned in this email is still not fixed.

Can you please try compile libevent from GIT, since I remember some
patches that can be related to read-over-write, in particular [321] and
maybe you need to install some new flags (for evcon).

[GIT]: https://github.com/libevent/libevent
[321]: https://github.com/libevent/libevent/issues/321

But maybe I'm missing something.

Okay I found the PATCH:
--- http.c	2014-03-05 15:05:50.577168380 -0500
+++ http-patched.c	2014-03-05 15:11:13.629154795 -0500
@@ -373,7 +373,7 @@
 	    evhttp_error_cb,
 	    evcon);
 
-	bufferevent_enable(evcon->bufev, EV_WRITE);
+	bufferevent_enable(evcon->bufev, EV_READ | EV_WRITE);
 }
 
 static void
@@ -1150,7 +1150,10 @@
 	}
 
 	if (evcon->bufev != NULL)
+	{
+		bufferevent_disable(evcon->bufev, EV_READ|EV_WRITE);
 		bufferevent_free(evcon->bufev);
+	}
 
 	event_deferred_cb_cancel_(get_deferred_queue(evcon),
 	    &evcon->read_more_deferred_cb);

And I think that this can cause some problems, in particular that if.

[PATCH]: http://archives.seul.org/libevent/users/Mar-2014/msg00013.html

> >> > The original issue reported however is still very much in effect. It is
> >> > particularly problematic for long-polling type requests where the server
> >> > uses evhttp_send_reply_start() and then every once in a while does
> >> > evhttp_send_reply_chunk(). If the client closes the connection, the
> >> server
> >> > won't detect it during the period between different chunks but rather
> >> only
> >> > when attempting to send the next chunk. This period can be several
> >> minutes
> >> > so this can be a real issue for servers that handle many connections.

Do you have a reproducer?
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.