Re: Segfault in polipo-20140107

Aleksandar Kuktin <[email protected]> Fri, 14 Mar 2014 22:48:15 +0100
Newsgroups gmane.comp.web.polipo.user
Message-ID <20140314224815.5ad016e5@ikilid>
>On Fri, 14 Mar 2014 21:22:35 +0100
>Richard Z <[email protected]> wrote:

> I have meanwhile got a few more of those crashes, mine happen always
> in offline mode. It was trigered by logrotate because polipo was
> accidentally put into offline mode for logrotation

I have been looking at the code in client.c, I think I see the problem.

Let's start with httpClientNoticeRequest(). It gets passed the request
(whatever that is), it parses it and gets (1) the handle for the object
contained within and (2) some sort of a reference to a "connection". It
then fills the object from disk (using objectFillFromDisk()) and calls
httpServeObject() with the above connection. httpServeObject() then
proceeds to extract the request from the connection, extracts the
object from the request, fills it up from disk for the second time and
then proceeds to deallocate it, allocate a new object that it
"attaches" to the request and proceeds to call
httpClientNoticeRequest() with that request.

So, a bit of memory gets allocated, filled with data twice and then
deallocated all the while the stack keeps on growing.

This hypothesis is testable. If it won't inconvenience you too much
(and you still have at least one coredump around), can you please
test the following values:

A. from the httpClientNoticeRequest() stack:
  1. request
  2. request->connection
B. from the httpServeObject() stack:
  1. connection
  2. connection->request

If ((A1 == B2) && (B1 == A2)), then we have successfully isolated the
infinite loop for at least one of the two crashes.

If that truly *is* the loop, then it is obvious the problem is in the
defective data structure. We would then need to study the data
structures and see where, why and how do they get deformed.

-- 
Svi moji e-mailovi su kriptografski potpisani. Proverite ih.
All of my e-mails are cryptographically signed. Verify them.
--
You don't need an AI for a robot uprising.
Humans will do just fine.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech

_______________________________________________
Polipo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/polipo-users
signature.asc (application/pgp-signature, 836 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)

iQIcBAEBAgAGBQJTI3kfAAoJEKa4cgqNx31/SgMP/0dYxXOX5aQFP7gsAWS3q0sI
6xHD+WKiwKDm+CdAILY9gR5Cwd0pLCbm8qdXmRbeAB26rklRnbXrIVQFRAyv0Kly
RMuAgjSNqkLjdLR2Zky5G6nte1FeGv0uoSReOQIl9XFroWRdNuUrH4A7priscltt
Sv9ANrcVgSFwrJoLT2h9mXMWNyltuOGpvqKjofpILUwI/cQkVyzJQW1UgcZfV0aH
JU7CfvUy2Cy0MTIU5JjuLMhBol5Qx3slYrDc0lRzdMHIie94RDp4eblNTIHc3hTM
GGfKwRUOPImrOicHfciIGVnNFWcATP57kaG7VeN8IM2kZRXUWX/4kxNUDu+WSGP+
PsH6HnV1oDJaaiUB3Ts/fBPhundUi2M8zeyBlybFLc9Forjzn1wRj+v2O4ypaKPP
3NRJABYZSDPQilYvu3MD6QhwCulWeKH0bycTcyfa0zgeT3ckKbQKIR4mfPJM2/ki
ASXrFcWVo+KCJUFqcNRMAqKVYZyypkB5L/zfcUkkBJM9iklZi+CZe59CffgwirwR
aPghcQRMtEComi3i44h2Tkc+O7GsSg1Wj+GNY7LKjEkTKqElCv6U0bJqt+53q6en
du2mX6Ne0D+SgsT9dJrnfoxZ1k009loobG+K1Qq6tBVd2nM6YNJLgD7hajuDyEt1
d39NL9fijP8+trHxzteO
=yH0a
-----END PGP SIGNATURE-----