Hi,

summary of my debugging session:

- The freeze happens once you install python-lxml, there is no proble mwith 
other etree implementations ogcserver imports.
- I can reproduce it with just mod_python + ogcserver + mapnik (0.7 in ubuntu), 
no wsgi involved
- It looks the problem is a deadlock involving the GIL. I tried moving the 
load_XML call outside the __init__ function, so that it was not under an import 
call, but no luck. Some other code must be acquiring the GIL and not releasing 
it. I'll try to debug the GIL to find the problem.

As you can see in the backtrace, lxml etree implementation will call 
PyGILState_Ensure, which will cause the thread to sleep, waiting for some other 
code to release the GIL => deadlock because that will never happen.

Here is some inspiration:
http://bugs.python.org/issue7736

And some documentation:
http://wiki.python.org/moin/boost.python/HowTo


(gdb) backtrace
#0 0xb773b430 in __kernel_vsyscall ()
#1 0xb769b245 in sem_wait@@GLIBC_2.1 () from  /lib/tls/i686/cmov/libpthread.so.0
#2 0xb65fce10 in PyThread_acquire_lock (lock=0xb80f1568, waitflag=1) at 
../Python/thread_pthread.h:349
#3 0xb65cc798 in PyEval_RestoreThread (tstate=0xb809b9a0) at 
../Python/ceval.c:353
#4 0xb65efa90 in PyGILState_Ensure () at ../Python/pystate.c:592
#5 0xb237465e in __pyx_f_4lxml_5etree__local_resolver (__pyx_v_c_url=0xb855194c 
"/home/manel/ogcserver/world.xml",
__pyx_v_c_pubid=0x0, __pyx_v_c_context=0xb855b4c8) at 
src/lxml/lxml.etree.c:62627
#6 0xb6931343 in xmlLoadExternalEntity () from /usr/lib/libxml2.so.2
#7 0xb6920891 in xmlCtxtReadFile () from /usr/lib/libxml2.so.2
#8 0xb53cbc64 in mapnik::libxml2_loader::load(std::string 
const&,boost::property_tree::basic_ptree<boost::property_tree::ptree_traits<char>
 >&) () from /usr/lib/libmapnik.so.0.7
#9 0xb53ca537 in mapnik::read_xml2(std::string const&,
boost::property_tree::basic_ptree<boost::property_tree::ptree_traits<char> >&) 
() from /usr/lib/libmapnik.so.0.7
#10 0xb538a7e4 in mapnik::load_map(mapnik::Map&, std::string const&, bool) () 
from /usr/lib/libmapnik.so.0.7
#11 0xb55bd83c in 
load_map_overloads::non_void_return_type::gen<boost::mpl::vector4<void, 
mapnik::Map&, std::string const&, bool> >::func_1(mapnik::Map&, std::string 
const&, bool) () from /usr/lib/pymodules/python2.6/mapnik/_mapnik.so
...

--
Manel

________________________________

        De: [email protected] 
[mailto:[email protected]] En nombre de Dane Springmeyer
        Enviado el: sábado, 02 de octubre de 2010 0:13
        Para: [email protected]
        CC: [email protected]
        Asunto: Re: [Mapnik-users] Problem with Mapniks OGCServer


        Okay, I think I found it.

        Putting this in your WSGI config should fix it:

        WSGIApplicationGroup %{GLOBAL}

        More details here:

        
https://techknowhow.library.emory.edu/blogs/branker/2010/07/30/django-lxml-wsgi-and-python-sub-interpreter-magic

        So, this should allow the ogcserver to play nicely within mod_wsgi with 
lxml installed. If this fixes the hang for you then we can investigate more. If 
not, then make sure you are only running one instance of the ogcserver within 
Apache.

        Dane


        On Oct 1, 2010, at 10:59 AM, [email protected] wrote:


                Hi, I forgot something...
                when uninstalling lxml, mod_wsgi can actually connect to 
mapniks ogcserver (ogcserver welcome appears). as Dane said earlier in this 
thread, mapnik falls back to standard xml support. at least this machine 
should... but with a GetMap request the browser still returns no map, the text 
of the requested URL gets rendered as an unformatted image instead.

                Daniel


                Am 30.09.2010 18:14, schrieb Dane Springmeyer:
                >
                > On Sep 1, 2010, at 3:57 AM,<[email protected]>  
<[email protected]>  wrote:
                >
                >> Hi,
                >>
                >> Just tried and I can reproduce the same problem here. Ubuntu 
server 9.10, Mapnik 0.7.1, mod_python will get stuck in Mapnik's load_map in 
WMS.py.
                >>
                >> Strange enough, I'm using the *same* code under wsgi with no 
problems.
                >>
                >
                > Daniel look ^^^. So Manel, what Apache version, prefork or 
worker, and what mod_wsgi and python versions?
                >
                > Btw, I forgot to mention the ticket we once had that tracked 
this issue (at lease specific to GetCaps):
                >
                > http://trac.mapnik.org/ticket/464
                >
                > It would be good to add any additional info we find to that 
ticket thread. For instance, short of understanding the exact problem within 
lxml, hopefully we can recommend a certain version of python/apache/mod_wsgi 
which will work around the problem.
                >
                > - Dane



                GKSS-Forschungszentrum Geesthacht GmbH
                Max-Planck-Straße 1
                21502 Geesthacht
                Deutschland/Germany

                Geschäftsführer/Board of Management: Prof. Dr. Wolfgang A. 
Kaysser, Dipl.-Ing. Michael Ganß
                Vorsitzender des Aufsichtsrates/Chairman of the Supervisory 
Board: Ministerialrat Wilfried Kraus

                Amtsgericht Lübeck  HRB 285 GE (Register Court)
                Internet: http://www.gkss.de

                ACHTUNG - ATTENTION

                Die GKSS-Forschungszentrum Geesthacht GmbH erhält einen neuen 
Namen und heißt ab dem 1. November 2010 offiziell
                The GKSS-Forschungszentrum Geesthacht GmbH will change its name 
and will as of 1st November 2010 be officially called

                Helmholtz-Zentrum Geesthacht
                Zentrum für Material- und Küstenforschung GmbH 
_______________________________________________
                Mapnik-users mailing list
                [email protected]
                https://lists.berlios.de/mailman/listinfo/mapnik-users



_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to