fish2000/django-imagekit — Issue #2: Subtle changes to processors.pyx makes the module segfault all over itself
Author: fish2000
Created: 2011-10-25 23:53:22+00:00
State: open

I had high hopes for this code (which has since been reverted):

https://github.com/fish2000/django-imagekit/blob/09355257e47bcf92f810e8be8aa9279028308bc9/imagekit/ext/processors.pyx

... on OSX, running the tests after compiling this stuff would result in the python interpreter segfaulting its pants (error #11 specifically) at some point between the call to imagekit.ext.Atkinsonify and the sys.exit(0) I have at the end of the runner script.

Execution of the same on Debian Sarge halts at the first call into cython, segfaulting everywhere. Check it out:

objectsinspaceandtime:django-imagekit-f2k[cython-develop •]$ python ./imagekit/tests.py
*** Starting test Redis server instance (pid = 18411)
nosetests --verbosity 2 imagekit.tests:IKTest --rednose --nocapture --nologcapture
Creating test database for alias 'default' ('/tmp/tmptjwk7a/imagekit-test.db')...
Destroying old test database 'default'...
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table signalqueue_enqueuedsignal
Creating table signalqueue_workerexceptionlog
Creating table imagekit_proof
Creating table imagekit_lumahistogram
Creating table imagekit_rgbhistogram
Creating table imagekit_iccmodel
Creating table imagekit_testimage
Creating table imagekit_testimagem
Installing custom SQL ...
Installing indexes ...
No fixtures found.
test_atkinsonizer (imagekit.tests.IKTest) ...
Loading image: http://ost2.s3.amazonaws.com/images/_uploads/P4141870.jpg
2011-10-25 01:00:11,067 [INFO] imagekit: Applying processors: SmarterCropped
2011-10-25 01:00:11,068 [INFO] imagekit: *** creating: cache/testimages/test_smartercropped.jpeg
2011-10-25 01:00:11,089 [INFO] imagekit: Applying processors: SmarterCropped, Atkinsonify
2011-10-25 01:00:11,090 [INFO] imagekit: +++ Atkinsonify processing with
*** glibc detected *** python: munmap_chunk(): invalid pointer: 0x00000000128d6b60 ***
======= Backtrace: =========
/lib/libc.so.6(+0x71ad6)[0x2b4a0ea63ad6]
/usr/local/lib/python2.7/site-packages/numpy/core/multiarray.so(+0xc2b7d)[0x2b4a1a5b9b7d]
/home/fish/Dropbox/imagekit/django-imagekit-f2k/imagekit/ext/processors.so(+0x11ac3)[0x2b4a20f72ac3]
/usr/local/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x59a9)[0x2b4a0de6b489]
/usr/local/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x8a8)[0x2b4a0de6cfa8]
/usr/local/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x5992)[0x2b4a0de6b472]
/usr/local/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x6bda)[0x2b4a0de6c6ba]

Apparently, glibc was detected! On my server, this whole time... the horror.

Srsly, if you're a cython grand-master and you have some time to kill, tell we what I did wrong in there. Thx.