I've been tracking down a bug in Poilpo for a while now. I'm running Polipo
1.0.4.1. I'm connecting it to a parent SOCKS proxy and disabling the on
disk cache.
Whenever I download a large file, the download always gets stuck around this
many bytes:
25,157,209
25,156,574
25,155,221
I've been debugging polipo and have figured out that the problem starts
right when the function discardObjects is called. Here is the stack trace:
#0 discardObjects (all=0, force=0) at object.c:807
#1 0x000000000040634c in maybe_free_chunks (arenas=0,
force=<value optimized out>) at chunk.c:102
#2 0x00000000004064d8 in get_chunk () at chunk.c:353
#3 0x0000000000417649 in httpServerReadData (connection=0x639a50,
immediate=76754139) at server.c:2538
#4 0x0000000000404908 in do_scheduled_stream (status=<value optimized
out>,
event=0x639ec0) at io.c:284
#5 0x00000000004041e2 in eventLoop () at event.c:713
#6 0x000000000040d453 in main (argc=1, argv=<value optimized out>)
at main.c:165
get_chunk is calling maybe_free_chunks because of:
if(used_chunks >= CHUNKS(chunkHighMark))
maybe_free_chunks(0, 0);
This makes sense:
(gdb) print used_chunks
$3 = 3072
(gdb) print chunkHighMark
$4 = 25165824
(gdb) print 25165824 / 8192
$9 = 3072
Somewhere in it's attempt to discardObjects, it gets rid of the chunk we
need, that hasn't been served out yet.
So soon after that, httpServeChunkDelayed calls httpServeChunk.
Now, what we NEED httpServeChunk to do is to find the chunk, with len > 0,
and then call one of the do_stream methods.
Instead, object->chunks[i].data = NULL and object->chunks[i].size = 0.
So when this runs:
if(i < object->numchunks)
len = object->chunks[i].size - j;
j is some offset into the chunk, so len becomes negative. So none of the
do_stream methods ever gets called. So the client never gets any more data.
poll() will never again care if the client becomes writable. The proxy
will continue the download, but the client will see their download stalled.
That's where I'm stuck. I'm not exactly sure what mechanism is supposed to
prevent discardObjects from deleting the chunk that we need. Hopefully the
author will find all of this information useful.
Has anyone else noticed that downloads through polipo stop after about 25
megabytes?
------------------------------------------------------------------------------
FREE DOWNLOAD - uberSVN with Social Coding for Subversion.
Subversion made easy with a complete admin console. Easy
to use, easy to manage, easy to install, easy to extend.
Get a Free download of the new open ALM Subversion platform now.
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Polipo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/polipo-users