This project is archived and is in readonly mode.

#198 ✓ invalid
Psycopg website

still "double free or corruption" crashes

Reported by Psycopg website | March 10th, 2014 @ 02:44 PM

Submitted by: ilengyel@yahoo.com

The package compiles without error; however, python codes using psycopg2 crashes randomly and frequently with "double free or corruption" error even on simple select queries (the client and server are on the same machine). OS is RHEL 6.5 (64-bit Intel-Xeon hardware), Python 2.6.6, Postgresql 9.3 and everything is compiled locally. No python crashes when connected from a remote machine which runs Fedora19 or 20 so the problem is not the server. On the remote client Psycopg2 was compiled using the same version of supporting libpq as on the server. It must be something related to compiler version or flags that may cause memory corruption. This "double free or corruption" problem appears to be an issue going back 5-6 years. Looks like there is no clear, stable solution yet. Tried to recompile psycopg2 with -O2 flag (solved the issue for one), but not for me. I am puzzled how the issue re-appears with every version of psycopg2 for some. I really like some features of postgresql, but this will force me back to mysql as I cannot change the OS on this specific machine.

Comments and changes to this ticket

  • Daniele Varrazzo

    Daniele Varrazzo March 10th, 2014 @ 03:05 PM

    Can you provide a stack trace of some sort?

    Are you sure 2.5.2 is the version you are using?

    If crashes are repeated it smells more you are somehow end up using a wrong version of free(): if we had widespread segfaults even on simple queries we'd have tons of reports by now and yours is the first. The problem you mention that may got fix by -O2 is probably the concurrency problem in #166 fixed in 2.5.1, but that was much harder to trigger.

  • Daniele Varrazzo

    Daniele Varrazzo April 3rd, 2014 @ 12:21 AM

    • State changed from “new” to “invalid”

    Closing this as it's unlikely it's our fault

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

WARNING: the informations in this tracker are archived. Please submit new tickets or comments to the new tracker.


Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins

Pages