Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python-psycopg2 double free or corruption with threading #899

Closed
yassineaboukir opened this issue Apr 14, 2019 · 1 comment
Closed

Python-psycopg2 double free or corruption with threading #899

yassineaboukir opened this issue Apr 14, 2019 · 1 comment

Comments

@yassineaboukir
Copy link

Hi,

It looks like issue #384 is still reproducible running a multithreaded Python script. My testing environment is the following:

Name: psycopg2-binary
Version: 2.7.7
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.3 LTS
Release:	16.04
Codename:	xenial
python2.7

Error Stack Trace:

*** Error in `/usr/bin/python': double free or corruption (!prev): 0x00007f970000a850 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f97139b27e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f97139bb37a]
/lib/x86_64-linux-gnu/libc.so.6(+0x83350)[0x7f97139be350]
/lib/x86_64-linux-gnu/libc.so.6(realloc+0x179)[0x7f97139bf839]
/usr/local/lib/python2.7/dist-packages/psycopg2/.libs/./libcrypto-c1fa9491.so.1.0.2q(CRYPTO_realloc+0x49)[0x7f970fbcd289]
/usr/local/lib/python2.7/dist-packages/psycopg2/.libs/./libcrypto-c1fa9491.so.1.0.2q(lh_insert+0x18f)[0x7f970fc80a2f]
/usr/local/lib/python2.7/dist-packages/psycopg2/.libs/./libcrypto-c1fa9491.so.1.0.2q(+0x1205f0)[0x7f970fc835f0]
/usr/local/lib/python2.7/dist-packages/psycopg2/.libs/./libcrypto-c1fa9491.so.1.0.2q(ERR_get_state+0x196)[0x7f970fc84536]
/usr/local/lib/python2.7/dist-packages/psycopg2/.libs/./libcrypto-c1fa9491.so.1.0.2q(ERR_clear_error+0xf)[0x7f970fc8482f]
/usr/local/lib/python2.7/dist-packages/psycopg2/.libs/libpq-bd31fe2b.so.5.11(+0x24ec1)[0x7f97102a7ec1]
/usr/local/lib/python2.7/dist-packages/psycopg2/.libs/libpq-bd31fe2b.so.5.11(PQconnectPoll+0xb78)[0x7f9710291ba8]
/usr/local/lib/python2.7/dist-packages/psycopg2/.libs/libpq-bd31fe2b.so.5.11(+0xfa28)[0x7f9710292a28]
/usr/local/lib/python2.7/dist-packages/psycopg2/.libs/libpq-bd31fe2b.so.5.11(PQconnectdb+0x1f)[0x7f971029541f]
/usr/local/lib/python2.7/dist-packages/psycopg2/_psycopg.so(+0x129c1)[0x7f97104e69c1]
/usr/local/lib/python2.7/dist-packages/psycopg2/_psycopg.so(+0x1374f)[0x7f97104e774f]
/usr/bin/python[0x4aaafb]
/usr/bin/python(PyObject_Call+0x3e)[0x4a587e]
/usr/bin/python(_PyObject_CallFunction_SizeT+0xfc)[0x52be9c]
/usr/local/lib/python2.7/dist-packages/psycopg2/_psycopg.so(+0xc268)[0x7f97104e0268]
/usr/bin/python(PyEval_EvalFrameEx+0x6f3e)[0x4c2e1e]
/usr/bin/python(PyEval_EvalCodeEx+0x306)[0x4b9b66]
/usr/bin/python(PyEval_EvalFrameEx+0x58e6)[0x4c17c6]
/usr/bin/python(PyEval_EvalCodeEx+0x306)[0x4b9b66]
/usr/bin/python(PyEval_EvalFrameEx+0x58e6)[0x4c17c6]
/usr/bin/python(PyEval_EvalCodeEx+0x306)[0x4b9b66]
/usr/bin/python[0x4d57a3]
/usr/bin/python(PyObject_Call+0x3e)[0x4a587e]
/usr/bin/python(PyEval_EvalFrameEx+0x263e)[0x4be51e]
/usr/bin/python(PyEval_EvalFrameEx+0x553f)[0x4c141f]
/usr/bin/python(PyEval_EvalFrameEx+0x553f)[0x4c141f]
/usr/bin/python(PyEval_EvalCodeEx+0x306)[0x4b9b66]
/usr/bin/python[0x4d5669]
/usr/bin/python[0x4eef5e]
/usr/bin/python(PyObject_Call+0x3e)[0x4a587e]
/usr/bin/python(PyEval_CallObjectWithKeywords+0x30)[0x4c5ef0]
/usr/bin/python[0x589662]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f9713d0c6ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f9713a4241d]
======= Memory map: ========
00400000-006de000 r-xp 00000000 fd:01 27812                              /usr/bin/python2.7

Any idea what might be causing this issue?

@dvarrazzo
Copy link
Member

No, this is not a case of #384, rather it is a manifestation of #543: the problem happens on connect with OpenSSL 1.0.2 and the binary packages.

I am just about to release psycopg 2.8.2 whose binary packages are built with OpenSSL 1.1 (see psycopg/psycopg2-wheels#8), it would be great if you could test with it.

I would also be really grateful if you could provide a test to reproduce the issue: I'm quite burnt out by the problems with the binary packages and I would really like to have a proof of the quality of OpenSSL 1.1 before endorsing them again.

I'll use this issue as a chance to thank again @matthew-brett and @jerickso for putting together the 1.1 build: amazing job :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants