Getstream starts to become unresponsive to HTTP requests after a few days

Florian Lohoff flo at rfc822.org
Fri Dec 25 12:24:05 CET 2009


On Fri, Dec 25, 2009 at 10:41:09AM +0000, James Creese wrote:
> Hi,
> 
> It became unresponsive yesterday, so I checked the number of FDs and indeed
> it was at the 1024 open files limit, so for now I've just increased the
> number of fds and hopefully this should help until someone is able to fix
> the problem (I'd fix it but I'm still a novice in C/C++ programming)

Just had a quick look at the http code - as i remembered you were doing http streaming.

The only way to loose fd's by not closing http connections might be
due to urls queried which do not exist, together with http keepalive.

The 404 handler triggers http_request_end which in turn only drops
the connection in case of non keepalive.

You might want to try this patch - it simply ignores the keepalive state. The real
fix would be to start a timer and drop the connection after some 
seconds/minutes if no new request arrives.

But i'd rather drop my own http implementation and use the libevent http
implementation or libmicrohttp or stuff - There should be tons of
implementations out there, more complete, more bugfree than mine.

diff --git a/libhttp.c b/libhttp.c
index 449cd5a..f4702cb 100644
--- a/libhttp.c
+++ b/libhttp.c
@@ -444,14 +444,7 @@ void http_drop_connection(struct http_connection *hc) {
  *
  */
 void http_request_end(struct http_connection *hc) {
-	if (!hc->keepalive) {
-		http_drop_connection(hc);
-	} else {
-		http_request_free(hc);
-		hc->status=HC_STATUS_HEAD;
-		hc->url_handler=&http_url_handler_404;
-		hc->hsize=0;
-	}
+	http_drop_connection(hc);
 }
 
 /*

Flo
-- 
Florian Lohoff                                         flo at rfc822.org
"Es ist ein grobes Missverständnis und eine Fehlwahrnehmung, dem Staat
im Internet Zensur- und Überwachungsabsichten zu unterstellen."
- - Bundesminister Dr. Wolfgang Schäuble -- 10. Juli in Berlin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://gt.owl.de/pipermail/getstream/attachments/20091225/b21eadce/attachment.pgp>


More information about the Getstream mailing list