localwiki/localwiki — Issue #130: Occasional self-intersection map segfault
Author: philipn
Created: 2011-11-29 10:37:33+00:00
State: open

Occasionally, and on some systems (like a test EC2 VM with a stock localwiki install) we see a segfault when saving a map with a self-intersection.

Almost certainly related to https://code.djangoproject.com/ticket/13843, though I can't figure out why it's happening just with self-intersections for us. It doesn't seem like we have any "GEOSGeometry globals" as that guy suggests, either.

```
[Tue Nov 29 04:24:49 2011] [error] GEOS_NOTICE: Self-intersection at or near point -122.507 37.7852
*** glibc detected *** (wsgi:example.com: free(): invalid next size (normal): 0xb98a7430 ***
======= Backtrace: =========
/lib/tls/i686/nosegneg/libc.so.6(+0x6c321)[0xb76ba321]
/lib/tls/i686/nosegneg/libc.so.6(+0x6db78)[0xb76bbb78]
/lib/tls/i686/nosegneg/libc.so.6(cfree+0x6d)[0xb76bec9d]
/usr/lib/libpython2.6.so.1.0(PyObject_Free+0x54)[0xb7370ea4]
/usr/lib/libpython2.6.so.1.0(+0x7d8d7)[0xb73788d7]
/usr/lib/libpython2.6.so.1.0(+0x6f374)[0xb736a374]
/usr/lib/libpython2.6.so.1.0(+0x61b69)[0xb735cb69]
/usr/lib/libpython2.6.so.1.0(+0x6f374)[0xb736a374]
/usr/lib/libpython2.6.so.1.0(+0x102eee)[0xb73fdeee]
/usr/lib/libpython2.6.so.1.0(+0x102f21)[0xb73fdf21]
/usr/lib/libpython2.6.so.1.0(PyObject_SetAttr+0x90)[0xb736ede0]
/usr/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x2b59)[0xb73cb5b9]
/usr/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x86d)[0xb73cecbd]
/usr/lib/libpython2.6.so.1.0(+0x5bf87)[0xb7356f87]
/usr/lib/libpython2.6.so.1.0(PyObject_Call+0x5c)[0xb7327edc]
/usr/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x3542)[0xb73cbfa2]
/usr/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x86d)[0xb73cecbd]
/usr/lib/libpython2.6.so.1.0(PyEval_EvalFrameEx+0x4358)[0xb73ccdb8]
/usr/lib/libpython2.6.so.1.0(PyEval_EvalCodeEx+0x86d)[0xb73cecbd]
/usr/lib/libpython2.6.so.1.0(+0x5be97)[0xb7356e97]
/usr/lib/libpython2.6.so.1.0(PyObject_Call+0x5c)[0xb7327edc]
/usr/lib/libpython2.6.so.1.0(+0x3ee34)[0xb7339e34]
/usr/lib/libpython2.6.so.1.0(PyObject_Call+0x5c)[0xb7327edc]
/usr/lib/libpython2.6.so.1.0(+0x9503d)[0xb739003d]
/usr/lib/libpython2.6.so.1.0(PyObject_Call+0x5c)[0xb7327edc]
/usr/lib/libpython2.6.so.1.0(PyEval_CallObjectWithKeywords+0x54)[0xb73c7c24]
/usr/lib/apache2/modules/mod_wsgi.so(+0x11121)[0xb7566121]
/usr/lib/apache2/modules/mod_wsgi.so(+0x16797)[0xb756b797]
/usr/lib/libapr-1.so.0(+0x251e1)[0xb77eb1e1]
/lib/tls/i686/nosegneg/libpthread.so.0(+0x5985)[0xb77b1985]
/lib/tls/i686/nosegneg/libc.so.6(clone+0x5e)[0xb771e13e]
======= Memory map: ========
ab900000-ab921000 rw-p 00000000 00:00 0
ab921000-aba00000 ---p 00000000 00:00 0
aba29000-aba57000 r-xp 00000000 08:01 52353 /usr/lib/python2.6/lib-dynload/pyexpat.so
aba57000-aba59000 r--p 0002d000 08:01 52353 /usr/lib/python2.6/lib-dynload/pyexpat.so
aba59000-aba5a000 rw-p 0002f000 08:01 52353 /usr/lib/python2.6/lib-dynload/pyexpat.so
aba5a000-aba5b000 rw-p 00000000 00:00 0
aba5b000-aba63000 r-xp 00000000 08:01 52327 /usr/lib/python2.6/lib-dynload/_elementtree.so
aba63000-aba64000 r--p 00007000 08:01 52327 /usr/lib/python2.6/lib-dynload/_elementtree.so
aba64000-aba65000 rw-p 00008000 08:01 52327 /usr/lib/python2.6/lib-dynload/_elementtree.so
aba65000-aba6c000 r-xp 00000000 08:01 50031 /usr/lib/pyshared/python2.6/simplejson/_speedups.so
aba6c000-aba6d000 r--p 00006000 08:01 50031 /usr/lib/pyshared/python2.6/simplejson/_speedups.so
aba6d000-aba6e000 rw-p 00007000 08:01 50031 /usr/lib/pyshared/python2.6/simplejson/_speedups.so
aba6e000-aba75000 r--s 00000000 08:01 42739 /usr/lib/gconv/gconv-modules.cache
aba75000-aba78000 r-xp 00000000 08:01 52315 /usr/lib/python2.6/lib-dynload/_bytesio.so
aba78000-aba79000 r--p 00002000 08:01 52315 /usr/lib/python2.6/lib-dynload/_bytesio.so
aba79000-aba7a000 rw-p 00003000 08:01 52315 /usr/lib/python2.6/lib-dynload/_bytesio.so
aba7a000-abb9e000 r-xp 00000000 08:01 33563 /usr/lib/libxml2.so.2.7.6
abb9e000-abb9f000 ---p 00124000 08:01 33563 /usr/lib/libxml2.so.2.7.6
abb9f000-abba3000 r--p 00124000 08:01 33563 /usr/lib/libxml2.so.2.7.6
abba3000-abba4000 rw-p 00128000 08:01 33563 /usr/lib/libxml2.so.2.7.6
abba4000-abba5000 rw-p 00000000 00:00 0
abba5000-abbb6000 r-xp 00000000 08:01 79367 /usr/lib/libexslt.so.0.8.15
abbb6000-abbb7000 r--p 00010000 08:01 79367 /usr/lib/libexslt.so.0.8.15
abbb7000-abbb8000 rw-p 00011000 08:01 79367 /usr/lib/libexslt.so.0.8.15
abbb8000-abbee000 r-xp 00000000 08:01 79368 /usr/lib/libxslt.so.1.1.26
abbee000-abbef000 r--p 00035000 08:01 79368 /usr/lib/libxslt.so.1.1.26
abbef000-abbf0000 rw-p 00036000 08:01 79368 /usr/lib/libxslt.so.1.1.26
abbf1000-abbf4000 r-xp 00000000 08:01 52328 /usr/lib/python2.6/lib-dynload/_fileio.so
abbf4000-abbf5000 r--p 00002000 08:01 52328 /usr/lib/python2.6/lib-dynload/_fileio.so
abbf5000-abbf6000 rw-p 00003000 08:01 52328 /usr/lib/python2.6/lib-dynload/_fileio.so
abbf6000-abcd3000 r-xp 00000000 08:01 71173 /usr/lib/python2.6/dist-packages/lxml/etree.so
abcd3000-abcd4000 r--p 000dd000 08:01 71173 /usr/lib/python2.6/dist-packages/lxml/etree.so
abcd4000-abcf4000 rw-p 000de000 08:01 71173 /usr/lib/python2.6/dist-packages/lxml/etree.so
abcf4000-abcfb000 rw-p 00000000 00:00 0
abcfb000-abd2b000 r-xp 00000000 08:01 33529 /usr/lib/libidn.so.11.5.44
abd2b000-abd2c000 r--p 0002f000 08:01 33529 /usr/lib/libidn.so.11.5.44
abd2c000-abd2d000 rw-p 00030000 08:01 33529 /usr/lib/libidn.so.11.5.44
abd2d000-abd60000 r-xp 00000000 08:01 79100 /usr/lib/libproj.so.0.6.6
abd60000-abd61000 r--p 00032000 08:01 79100 /usr/lib/libproj.so.0.6.6
abd61000-abd63000 rw-p 00033000 08:01 79100 /usr/lib/libproj.so.0.6.6
abd61000-abd63000 rw-p 00033000 08:01 79100 /usr/lib/libproj.so.0.6.6
abd63000-acca8000 r--p 00000000 08:01 79109 /usr/lib/libicudata.so.42.1
acca8000-acca9000 r--p 00f44000 08:01 79109 /usr/lib/libicudata.so.42.1
acca9000-acde0000 r-xp 00000000 08:01 79115 /usr/lib/libicuuc.so.42.1
acde0000-acde1000 ---p 00137000 08:01 79115 /usr/lib/libicuuc.so.42.1
acde1000-acde9000 r--p 00137000 08:01 79115 /usr/lib/libicuuc.so.42.1
acde9000-acdeb000 rw-p 0013f000 08:01 79115 /usr/lib/libicuuc.so.42.1
acdeb000-acded000 rw-p 00000000 00:00 0
acded000-acdf4000 r-xp 00000000 08:01 79128 /usr/lib/libltdl.so.7.2.1
acdf4000-acdf5000 r--p 00006000 08:01 79128 /usr/lib/libltdl.so.7.2.1
acdf5000-acdf6000 rw-p 00007000 08:01 79128 /usr/lib/libltdl.so.7.2.1
acdf6000-acf2f000 r-xp 00000000 08:01 79060 /usr/lib/libgeos-3.1.0.so
acf2f000-acf33000 r--p 00138000 08:01 79060 /usr/lib/libgeos-3.1.0.so
acf33000-acf34000 rw-p 0013c000 08:01 79060 /usr/lib/libgeos-3.1.0.so
acf34000-acf51000 r-xp 00000000 08:01 57538 /lib/libgcc_s.so.1
acf51000-acf52000 r--p 0001c000 08:01 57538 /lib/libgcc_s.so.1
acf52000-acf53000 rw-p 0001d000 08:01 57538 /lib/libgcc_s.so.1
acf53000-ad03c000 r-xp 00000000 08:01 33559 /usr/lib/libstdc++.so.6.0.13
ad03c000-ad03d000 ---p 000e9000 08:01 33559 /usr/lib/libstdc++.so.6.0.13
ad03d000-ad041000 r--p 000e9000 08:01 33559 /usr/lib/libstdc++.so.6.0.13
ad041000-ad042000 rw-p 000ed000 08:01 33559 /usr/lib/libstdc++.so.6.0.13
ad042000-ad049000 rw-p 00000000 00:00 0
ad049000-ad1f3000 r-xp 00000000 08:01 79090 /usr/lib/libmysqlclient.so.16.0.0
ad1f3000-ad1f4000 ---p 001aa000 08:01 79090 /usr/lib/libmysqlclient.so.16.0.0
ad1f4000-ad1f7000 r--p 001aa000 08:01 79090 /usr/lib/libmysqlclient.so.16.0.0
ad1f7000-ad23c000 rw-p 001ad000 08:01 79090 /usr/lib/libmysqlclient.so.16.0.0
ad23c000-ad23d000 rw-p 00000000 00:00 0
ad23d000-ad27b000 r-xp 00000000 08:01 33497 /usr/lib/libcurl-gnutls.so.4.1.1
ad27b000-ad27c000 r--p 0003d000 08:01 33497 /usr/lib/libcurl-gnutls.so.4.1.1
ad27c000-ad27d000 rw-p 0003e000 08:01 33497 /usr/lib/libcurl-gnutls.so.4.1.1
ad27d000-ad2e5000 r-xp 00000000 08:01 79095 /usr/lib/libnetcdf.so.4.0.0
ad2e5000-ad322000 r--p 00067000 08:01 79095 /usr/lib/libnetcdf.so.4.0.0
ad322000-ad323000 rw-p 000a4000 08:01 79095 /usr/lib/libnetcdf.so.4.0.0
ad323000-ad324000 rw-p 00000000 00:00 0
ad324000-ad347000 r-xp 00000000 08:01 57571 /lib/libpng12.so.0.42.0
ad347000-ad348000 r--p 00022000 08:01 57571 /lib/libpng12.so.0.42.0
ad348000-ad349000 rw-p 00023000 08:01 57571 /lib/libpng12.so.0.42.0
ad349000-ad368000 r-xp 00000000 08:01 33990 /usr/lib/libjpeg.so.62.0.0
....
b89ed000-b999c000 rw-p 00000000 00:00 0 [heap]
bfeb3000-bfeca000 rw-p 00000000 00:00 0 [stack]
[Tue Nov 29 10:26:42 2011] [error] [client 173.228.123.102] Premature end of script headers: localwiki.wsgi, referer: http://ec2-50-18-68-252.us-west-1.compute.amazonaws.com/map/Front_Page/_edit
[Tue Nov 29 10:26:43 2011] [notice] child pid 6668 exit signal Aborted (6)
[Tue Nov 29 04:26:49 2011] [error] DOES PRINT SHOW
[Tue Nov 29 04:26:49 2011] [error] GEOS_NOTICE: Self-intersection at or near point -122.507 37.7852
[Tue Nov 29 10:26:49 2011] [error] [client 173.228.123.102] Premature end of script headers: localwiki.wsgi, referer: http://ec2-50-18-68-252.us-west-1.compute.amazonaws.com/map/Front_Page/_edit
[Tue Nov 29 10:26:49 2011] [error] [client 173.228.123.102] Premature end of script headers: localwiki.wsgi
[Tue Nov 29 10:26:50 2011] [notice] child pid 6686 exit signal Segmentation fault (11)
[Tue Nov 29 04:26:52 2011] [error] DOES PRINT SHOW
[Tue Nov 29 10:27:15 2011] [error] Exception KeyError: KeyError(-1218569584,) in ignored
[Tue Nov 29 10:27:15 2011] [error] Exception KeyError: KeyError(-1218569584,) in ignored
[Tue Nov 29 10:27:15 2011] [notice] caught SIGTERM, shutting down
[Tue Nov 29 10:27:15 2011] [error] Exception KeyError: KeyError(-1218569584,) in ignored
[Tue Nov 29 04:27:15 2011] [error] Exception KeyError: KeyError(-1218569584,) in ignored
[Tue Nov 29 04:27:15 2011] [error] Exception AttributeError: "'NoneType' object has no attribute 'destroy_geom'" in Exception AttributeError: "'NoneType' object has no attribute 'destroy_geom'" in
[Tue Nov 29 10:27:18 2011] [notice] Apache/2.2.14 (Ubuntu) mod_wsgi/2.8 Python/2.6.5 configured -- resuming normal operations
```