artemp/mapnik — Issue #729: segfault in postgis driver if abrupt exit
Author: artemp
Created: 2011-10-11 16:34:03+00:00
State: open
Labels: Core_Library

I got really annoyed at the inability to ctrl-c the threaded generate_tiles script, so I modified to all direct exit: http://trac.openstreetmap.org/changeset/25586

This segfaults mapnik:

{{{
osm2 : 14 14593 6344 exists
^C
Program received signal SIGINT, Interrupt.
[Switching to Thread 0x7fff81329910 (LWP 24724)]
0x00007ffff7bcf37a in pthread_sigmask () from /lib/libpthread.so.0
(gdb) thread apply all bt

Thread 5 (Thread 0x7fff81329910 (LWP 24724)):
#0 0x00007ffff7bcf37a in pthread_sigmask () from /lib/libpthread.so.0
#1 0x00007fffeeaaeb33 in ?? () from /usr/lib/libpq.so.5
#2 0x00007fffeeaaecf1 in ?? () from /usr/lib/libpq.so.5
#3 0x00007fffeeaa6e9c in ?? () from /usr/lib/libpq.so.5
#4 0x00007fffeeaa4815 in ?? () from /usr/lib/libpq.so.5
#5 0x00007fffeeaa4977 in PQsendQueryParams () from /usr/lib/libpq.so.5
#6 0x00007fffeeaa60b0 in PQexecParams () from /usr/lib/libpq.so.5
#7 0x00007fffeece5da7 in Connection::executeQuery(std::string const&, int) const ()
from /usr/local/lib/mapnik2/input/postgis.input
#8 0x00007fffeecd47d4 in postgis_datasource::get_resultset(boost::shared_ptr const&, std::string const&) const
() from /usr/local/lib/mapnik2/input/postgis.input
#9 0x00007fffeecd6f27 in postgis_datasource::features(mapnik::query const&) const ()
from /usr/local/lib/mapnik2/input/postgis.input
#10 0x00007ffff67ed557 in mapnik::feature_style_processor >::apply_to_layer(mapnik::layer const&, mapnik::agg_renderer&, mapnik::projection const&, double) ()
from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#11 0x00007ffff67edfa9 in mapnik::feature_style_processor >::apply() ()
from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#12 0x00007ffff67c0664 in render(mapnik::Map const&, mapnik::image_32&, double, unsigned int, unsigned int) ()
from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#13 0x00007ffff67c5de6 in boost::python::detail::caller_arity<2u>::impl >::operator()(_object*, _object*) () from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#14 0x00007ffff59c116e in boost::python::objects::function::call(_object*, _object*) const ()
from /usr/local/lib/libboost_python.so.1.43.0
#15 0x00007ffff59c1358 in boost::detail::function::void_function_ref_invoker0::invoke(boost::detail::function::function_buffer&) () from /usr/local/lib/libboost_python.so.1.43.0
#16 0x00007ffff59c8eb3 in boost::python::detail::exception_handler::operator()(boost::function0 const&) const ()
from /usr/local/lib/libboost_python.so.1.43.0
#17 0x00007ffff67c2247 in boost::detail::function::function_obj_invoker2 to continue, or q to quit---
late_exception, boost::_bi::list3, boost::arg<2>, boost::_bi::value > >, bool, boost::python::detail::exception_handler const&, boost::function0 const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0 const&) () from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#18 0x00007ffff59c8e8d in boost::python::detail::exception_handler::operator()(boost::function0 const&) const ()
from /usr/local/lib/libboost_python.so.1.43.0
#19 0x00007ffff67c21e7 in boost::detail::function::function_obj_invoker2, boost::_bi::list3, boost::arg<2>, boost::_bi::value > >, bool, boost::python::detail::exception_handler const&, boost::function0 const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0 const&) () from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#20 0x00007ffff59c8c83 in boost::python::handle_exception_impl(boost::function0) ()
from /usr/local/lib/libboost_python.so.1.43.0
#21 0x00007ffff59bdf48 in function_call () from /usr/local/lib/libboost_python.so.1.43.0
#22 0x000000000041d6e7 in PyObject_Call ()
#23 0x00000000004a199c in PyEval_EvalFrameEx ()
#24 0x00000000004a2e47 in PyEval_EvalFrameEx ()
#25 0x00000000004a40e0 in PyEval_EvalCodeEx ()
#26 0x000000000052bf3d in ?? ()
#27 0x000000000041d6e7 in PyObject_Call ()
#28 0x00000000004a0f31 in PyEval_EvalFrameEx ()
#29 0x00000000004a2e47 in PyEval_EvalFrameEx ()
#30 0x00000000004a2e47 in PyEval_EvalFrameEx ()
#31 0x00000000004a40e0 in PyEval_EvalCodeEx ()
#32 0x000000000052be40 in ?? ()
#33 0x000000000041d6e7 in PyObject_Call ()
#34 0x00000000004254ff in ?? ()
#35 0x000000000041d6e7 in PyObject_Call ()
#36 0x000000000049c623 in PyEval_CallObjectWithKeywords ()
#37 0x00000000004d0bfd in ?? ()
#38 0x00007ffff7bc9a04 in start_thread () from /lib/libpthread.so.0
#39 0x00007ffff7090d4d in clone () from /lib/libc.so.6
---Type to continue, or q to quit---
#40 0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7fffa2e29910 (LWP 24723)):
#0 0x00007ffff62792b2 in mapnik::wkb_reader::read_polygon(mapnik::feature, mapnik::vertex_vector>, boost::shared_ptr >&) () from /usr/local/lib/libmapnik2.so.2.0
#1 0x00007ffff6278d7e in mapnik::geometry_utils::from_wkb(mapnik::feature, mapnik::vertex_vector>, boost::shared_ptr >&, char const*, unsigned int, bool, mapnik::wkbFormat) ()
from /usr/local/lib/libmapnik2.so.2.0
#2 0x00007fffeecef10f in postgis_featureset::next() () from /usr/local/lib/mapnik2/input/postgis.input
#3 0x00007ffff67ed614 in mapnik::feature_style_processor >::apply_to_layer(mapnik::layer const&, mapnik::agg_renderer&, mapnik::projection const&, double) ()
from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#4 0x00007ffff67edfa9 in mapnik::feature_style_processor >::apply() ()
from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#5 0x00007ffff67c0664 in render(mapnik::Map const&, mapnik::image_32&, double, unsigned int, unsigned int) ()
from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#6 0x00007ffff67c5de6 in boost::python::detail::caller_arity<2u>::impl >::operator()(_object*, _object*) () from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#7 0x00007ffff59c116e in boost::python::objects::function::call(_object*, _object*) const ()
from /usr/local/lib/libboost_python.so.1.43.0
#8 0x00007ffff59c1358 in boost::detail::function::void_function_ref_invoker0::invoke(boost::detail::function::function_buffer&) () from /usr/local/lib/libboost_python.so.1.43.0
#9 0x00007ffff59c8eb3 in boost::python::detail::exception_handler::operator()(boost::function0 const&) const ()
from /usr/local/lib/libboost_python.so.1.43.0
#10 0x00007ffff67c2247 in boost::detail::function::function_obj_invoker2, boost::_bi::list3, boost::arg<2>, boost::_bi::value > >, bool, boost::python::detail::exception_handler const&, boost::function0 const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0 const&) () from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#11 0x00007ffff59c8e8d in boost::python::detail::exception_handler::operator()(boost::function0 const&) const ()
from /usr/local/lib/libboost_python.so.1.43.0
---Type to continue, or q to quit---
#12 0x00007ffff67c21e7 in boost::detail::function::function_obj_invoker2, boost::_bi::list3, boost::arg<2>, boost::_bi::value > >, bool, boost::python::detail::exception_handler const&, boost::function0 const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0 const&) () from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#13 0x00007ffff59c8c83 in boost::python::handle_exception_impl(boost::function0) ()
from /usr/local/lib/libboost_python.so.1.43.0
#14 0x00007ffff59bdf48 in function_call () from /usr/local/lib/libboost_python.so.1.43.0
#15 0x000000000041d6e7 in PyObject_Call ()
#16 0x00000000004a199c in PyEval_EvalFrameEx ()
#17 0x00000000004a2e47 in PyEval_EvalFrameEx ()
#18 0x00000000004a40e0 in PyEval_EvalCodeEx ()
#19 0x000000000052bf3d in ?? ()
#20 0x000000000041d6e7 in PyObject_Call ()
#21 0x00000000004a0f31 in PyEval_EvalFrameEx ()
#22 0x00000000004a2e47 in PyEval_EvalFrameEx ()
#23 0x00000000004a2e47 in PyEval_EvalFrameEx ()
#24 0x00000000004a40e0 in PyEval_EvalCodeEx ()
#25 0x000000000052be40 in ?? ()
#26 0x000000000041d6e7 in PyObject_Call ()
#27 0x00000000004254ff in ?? ()
#28 0x000000000041d6e7 in PyObject_Call ()
#29 0x000000000049c623 in PyEval_CallObjectWithKeywords ()
#30 0x00000000004d0bfd in ?? ()
#31 0x00007ffff7bc9a04 in start_thread () from /lib/libpthread.so.0
#32 0x00007ffff7090d4d in clone () from /lib/libc.so.6
#33 0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7fffc4b82910 (LWP 24722)):
#0 0x00007ffff62792ab in mapnik::wkb_reader::read_polygon(mapnik::feature, mapnik::vertex_vector>, boost::shared_ptr >&) () from /usr/local/lib/libmapnik2.so.2.0
#1 0x00007ffff6278d7e in mapnik::geometry_utils::from_wkb(mapnik::feature, mapnik:---Type to continue, or q to quit---
:vertex_vector>, boost::shared_ptr >&, char const*, unsigned int, bool, mapnik::wkbFormat) ()
from /usr/local/lib/libmapnik2.so.2.0
#2 0x00007fffeecef10f in postgis_featureset::next() () from /usr/local/lib/mapnik2/input/postgis.input
#3 0x00007ffff67ed614 in mapnik::feature_style_processor >::apply_to_layer(mapnik::layer const&, mapnik::agg_renderer&, mapnik::projection const&, double) ()
from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#4 0x00007ffff67edfa9 in mapnik::feature_style_processor >::apply() ()
from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#5 0x00007ffff67c0664 in render(mapnik::Map const&, mapnik::image_32&, double, unsigned int, unsigned int) ()
from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#6 0x00007ffff67c5de6 in boost::python::detail::caller_arity<2u>::impl >::operator()(_object*, _object*) () from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#7 0x00007ffff59c116e in boost::python::objects::function::call(_object*, _object*) const ()
from /usr/local/lib/libboost_python.so.1.43.0
#8 0x00007ffff59c1358 in boost::detail::function::void_function_ref_invoker0::invoke(boost::detail::function::function_buffer&) () from /usr/local/lib/libboost_python.so.1.43.0
#9 0x00007ffff59c8eb3 in boost::python::detail::exception_handler::operator()(boost::function0 const&) const ()
from /usr/local/lib/libboost_python.so.1.43.0
#10 0x00007ffff67c2247 in boost::detail::function::function_obj_invoker2, boost::_bi::list3, boost::arg<2>, boost::_bi::value > >, bool, boost::python::detail::exception_handler const&, boost::function0 const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0 const&) () from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#11 0x00007ffff59c8e8d in boost::python::detail::exception_handler::operator()(boost::function0 const&) const ()
from /usr/local/lib/libboost_python.so.1.43.0
#12 0x00007ffff67c21e7 in boost::detail::function::function_obj_invoker2, boost::_bi::list3, boost::arg<2>, boost::_bi::value > >, bool, boost::python::detail::exception_handler const&, boost::function0 const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0 const&) () from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#13 0x00007ffff59c8c83 in boost::python::handle_exception_impl(boost::function0) ()
---Type to continue, or q to quit---
from /usr/local/lib/libboost_python.so.1.43.0
#14 0x00007ffff59bdf48 in function_call () from /usr/local/lib/libboost_python.so.1.43.0
#15 0x000000000041d6e7 in PyObject_Call ()
#16 0x00000000004a199c in PyEval_EvalFrameEx ()
#17 0x00000000004a2e47 in PyEval_EvalFrameEx ()
#18 0x00000000004a40e0 in PyEval_EvalCodeEx ()
#19 0x000000000052bf3d in ?? ()
#20 0x000000000041d6e7 in PyObject_Call ()
#21 0x00000000004a0f31 in PyEval_EvalFrameEx ()
#22 0x00000000004a2e47 in PyEval_EvalFrameEx ()
#23 0x00000000004a2e47 in PyEval_EvalFrameEx ()
#24 0x00000000004a40e0 in PyEval_EvalCodeEx ()
#25 0x000000000052be40 in ?? ()
#26 0x000000000041d6e7 in PyObject_Call ()
#27 0x00000000004254ff in ?? ()
#28 0x000000000041d6e7 in PyObject_Call ()
#29 0x000000000049c623 in PyEval_CallObjectWithKeywords ()
#30 0x00000000004d0bfd in ?? ()
#31 0x00007ffff7bc9a04 in start_thread () from /lib/libpthread.so.0
#32 0x00007ffff7090d4d in clone () from /lib/libc.so.6

#33 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7fffe7877910 (LWP 24721)):
#0 0x00007ffff70848e3 in poll () from /lib/libc.so.6
#1 0x00007fffeeaa6907 in ?? () from /usr/lib/libpq.so.5
#2 0x00007fffeeaa69d0 in ?? () from /usr/lib/libpq.so.5
#3 0x00007fffeeaa5ac9 in PQgetResult () from /usr/lib/libpq.so.5
#4 0x00007fffeeaa5d68 in ?? () from /usr/lib/libpq.so.5
#5 0x00007fffeece5da7 in Connection::executeQuery(std::string const&, int) const ()
from /usr/local/lib/mapnik2/input/postgis.input
#6 0x00007fffeecd47d4 in postgis_datasource::get_resultset(boost::shared_ptr const&, std::string const&) const
() from /usr/local/lib/mapnik2/input/postgis.input
---Type to continue, or q to quit---
#7 0x00007fffeecd6f27 in postgis_datasource::features(mapnik::query const&) const ()
from /usr/local/lib/mapnik2/input/postgis.input
#8 0x00007ffff67ed557 in mapnik::feature_style_processor >::apply_to_layer(mapnik::layer const&, mapnik::agg_renderer&, mapnik::projection const&, double) ()
from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#9 0x00007ffff67edfa9 in mapnik::feature_style_processor >::apply() ()
from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#10 0x00007ffff67c0664 in render(mapnik::Map const&, mapnik::image_32&, double, unsigned int, unsigned int) ()
from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#11 0x00007ffff67c5de6 in boost::python::detail::caller_arity<2u>::impl >::operator()(_object*, _object*) () from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#12 0x00007ffff59c116e in boost::python::objects::function::call(_object*, _object*) const ()
from /usr/local/lib/libboost_python.so.1.43.0
#13 0x00007ffff59c1358 in boost::detail::function::void_function_ref_invoker0::invoke(boost::detail::function::function_buffer&) () from /usr/local/lib/libboost_python.so.1.43.0
#14 0x00007ffff59c8eb3 in boost::python::detail::exception_handler::operator()(boost::function0 const&) const ()
from /usr/local/lib/libboost_python.so.1.43.0
#15 0x00007ffff67c2247 in boost::detail::function::function_obj_invoker2, boost::_bi::list3, boost::arg<2>, boost::_bi::value > >, bool, boost::python::detail::exception_handler const&, boost::function0 const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0 const&) () from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#16 0x00007ffff59c8e8d in boost::python::detail::exception_handler::operator()(boost::function0 const&) const ()
from /usr/local/lib/libboost_python.so.1.43.0
#17 0x00007ffff67c21e7 in boost::detail::function::function_obj_invoker2, boost::_bi::list3, boost::arg<2>, boost::_bi::value > >, bool, boost::python::detail::exception_handler const&, boost::function0 const&>::invoke(boost::detail::function::function_buffer&, boost::python::detail::exception_handler const&, boost::function0 const&) () from /usr/lib/python2.6/dist-packages/mapnik2/_mapnik2.so
#18 0x00007ffff59c8c83 in boost::python::handle_exception_impl(boost::function0) ()
from /usr/local/lib/libboost_python.so.1.43.0
---Type to continue, or q to quit---
#19 0x00007ffff59bdf48 in function_call () from /usr/local/lib/libboost_python.so.1.43.0
#20 0x000000000041d6e7 in PyObject_Call ()
#21 0x00000000004a199c in PyEval_EvalFrameEx ()
#22 0x00000000004a2e47 in PyEval_EvalFrameEx ()
#23 0x00000000004a40e0 in PyEval_EvalCodeEx ()
#24 0x000000000052bf3d in ?? ()
#25 0x000000000041d6e7 in PyObject_Call ()
#26 0x00000000004a0f31 in PyEval_EvalFrameEx ()
#27 0x00000000004a2e47 in PyEval_EvalFrameEx ()
#28 0x00000000004a2e47 in PyEval_EvalFrameEx ()
#29 0x00000000004a40e0 in PyEval_EvalCodeEx ()
#30 0x000000000052be40 in ?? ()
#31 0x000000000041d6e7 in PyObject_Call ()
#32 0x00000000004254ff in ?? ()
#33 0x000000000041d6e7 in PyObject_Call ()
#34 0x000000000049c623 in PyEval_CallObjectWithKeywords ()
#35 0x00000000004d0bfd in ?? ()
#36 0x00007ffff7bc9a04 in start_thread () from /lib/libpthread.so.0
#37 0x00007ffff7090d4d in clone () from /lib/libc.so.6
#38 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7ffff7feb6f0 (LWP 24716)):
#0 0x00007ffff7bd03c1 in sem_wait () from /lib/libpthread.so.0
#1 0x00000000004cd5a8 in PyThread_acquire_lock ()
#2 0x00000000004d07f2 in ?? ()
#3 0x00000000004a290d in PyEval_EvalFrameEx ()
#4 0x00000000004a40e0 in PyEval_EvalCodeEx ()
#5 0x00000000004a245f in PyEval_EvalFrameEx ()
#6 0x00000000004a40e0 in PyEval_EvalCodeEx ()
#7 0x00000000004a245f in PyEval_EvalFrameEx ()
#8 0x00000000004a40e0 in PyEval_EvalCodeEx ()
#9 0x00000000004a245f in PyEval_EvalFrameEx ()
---Type to continue, or q to quit---
#10 0x00000000004a40e0 in PyEval_EvalCodeEx ()
#11 0x00000000004a41b2 in PyEval_EvalCode ()
#12 0x00000000004c33a0 in PyRun_FileExFlags ()
#13 0x00000000004c3564 in PyRun_SimpleFileExFlags ()
#14 0x0000000000418ab7 in Py_Main ()
#15 0x00007ffff6fcfabd in __libc_start_main () from /lib/libc.so.6
#16 0x0000000000417ca9 in _start ()
(gdb)
(gdb)

}}}