Double free or Corruption error when using GeoDjango

244 views
Skip to first unread message

Tapan Pandita

unread,
May 19, 2016, 4:17:15 PM5/19/16
to Django users
I am running django 1.9.4 on gunicorn19.4.5 with the gevent worker (gevent==1.0.2, greenlet==0.4.9). My app is deployed on heroku. For some requests, I have noticed this error: "*** Error in `/app/.heroku/python/bin/python': double free or corruption (out): 0x000000000403bc90 ***". I can't reproduce it deterministically, but it happen in about 5% of all requests. I was able to get the stack trace for it and everytime it's the same:

May 19 13:50:35 <app-name> app/web.2:    File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/geos/geometry.py", line 125, in __del__.
May 19 13:50:35 <app-name> app/web.2:      capi.destroy_geom(self._ptr).
May 19 13:50:35 <app-name> app/web.2:    File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/geos/libgeos.py", line 157, in __call__.
May 19 13:50:35 <app-name> app/web.2:      return self.func(*args, **kwargs).
May 19 13:50:35 <app-name> app/web.2:    File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/gis/geos/prototypes/threadsafe.py", line 52, in __call__.
May 19 13:50:35 <app-name> app/web.2:      if not self.thread_context.handle:.
May 19 13:50:35 <app-name> app/web.2:    File "/app/.heroku/python/lib/python2.7/site-packages/gevent/local.py", line 173, in __getattribute__.
May 19 13:50:35 <app-name> app/web.2:      d = object.__getattribute__(self, '_local__dicts').get(getcurrent()).
May 19 13:50:35 <app-name> app/web.2:  *** Error in `/app/.heroku/python/bin/python': double free or corruption (out): 0x0000000003dd6470 ***

Can someone tell me what's going on? How can I fix this?

Thanks for any and all help,
Tapan

Erik Cederstrand

unread,
May 19, 2016, 5:38:45 PM5/19/16
to Django Users
This is bad. The python binary itself is crashing with a memory violation in C/C++ code in either Python or an external module (e.g. gevent). Unfortunately, your stack trace leaves no further hints about the source of the problem.

Normally, you would compile Python and any external C modules with debugging symbols and attach a debugger. I don't know Heroku very well, but your options are probably limited. Your best bet is probably to find a reproducible test case and contact their support team.

Erik

tapan pandita

unread,
May 24, 2016, 9:14:35 AM5/24/16
to django...@googlegroups.com
I have some more information. I set the MALLOC_CHECK_ environment variable to 3 and I got a backtrace. I have an issue open on gevent and the backtrace with other details is here: https://github.com/gevent/gevent/issues/808#issuecomment-221206899

It looks like a bug with how libgeos works with gunicorn using a gevent worker. Should I report this as a django bug?

Thanks,
Tapan


--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/zfqG7ZR3rQE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/92EC4AAF-B11F-4215-80E3-0221875A654F%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages