I don't know how stable the darcs repo is supposed to be.  I've been
running into a bug.  I didn't understand it enough to suggest a
solution, but I traced it through mechanically.

I found the following assert at io.c:281 was triggering:

assert(*request->u.l.buf_location == NULL);

I traced back the calls and found two paths in server.c where
do_stream_buf() might be called with *buf_location != NULL.  Both were
of the form

    if(connection->len == 0)
            httpConnectionDestroyBuf(connection);

    httpSetTimeout(connection, serverTimeout);
    do_stream_buf(IO_READ | (immediate ? IO_IMMEDIATE : 0) | IO_NOTNOW,
                      connection->fd, connection->len,
                      &connection->buf, CHUNK_SIZE,
                      httpServerReplyHandler, connection);

i.e. connection->buf will nulled out (after being freed) only if there's
no data left in it.  As an exercise, I hoisted the assertion

diff --git a/server.c b/server.c
index 478bb51..aabb07a 100644
--- a/server.c
+++ b/server.c
@@ -1375,8 +1375,8 @@ httpServerReply(HTTPConnectionPtr connection, int 
immediate)
            scrub(connection->request->object->key),
            connection->request->method);
 
-    if(connection->len == 0)
-        httpConnectionDestroyBuf(connection);
+    assert(connection->len == 0);
+    httpConnectionDestroyBuf(connection);
 
     httpSetTimeout(connection, serverTimeout);
     do_stream_buf(IO_READ | (immediate ? IO_IMMEDIATE : 0) | IO_NOTNOW,
@@ -2575,8 +2575,8 @@ httpServerReadData(HTTPConnectionPtr connection, int 
immediate)
         }
     }
        
-    if(connection->len == 0)
-        httpConnectionDestroyBuf(connection);
+    assert(connection->len == 0);
+    httpConnectionDestroyBuf(connection);
 
     httpSetTimeout(connection, serverTimeout);
     do_stream_buf(IO_READ | IO_NOTNOW |



and saw that the issue affects both call-sites

Established listening socket on port 8123.
Unsupported Cache-Control directive post-check -- ignored.
Unsupported Cache-Control directive pre-check -- ignored.
Restarting pipeline to groups.google.com:80.
Restarting pipeline to groups.google.com:80.
Couldn't send request to server: Immediate shutdown requested
Couldn't send request to server: Immediate shutdown requested
Restarting pipeline to groups.google.com:80.
polipo: server.c:1379: httpServerReply: Assertion `connection->len == 0'
failed.


Established listening socket on port 8123.
polipo: server.c:2578: httpServerReadData: Assertion `connection->len ==
0' failed.


Alan

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Polipo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/polipo-users

Reply via email to