I cant duplicate the same error message on Python 2.6.5 on MacOS X.

I do note though that some processes just don't shutdown cleanly at all.

[Fri Apr 09 21:21:04 2010] [info] mod_wsgi (pid=26874): Destroying interpreters.
[Fri Apr 09 21:21:04 2010] [info] mod_wsgi (pid=26874): Cleanup interpreter ''.
[Fri Apr 09 21:21:08 2010] [warn] child process 26874 still did not
exit, sending a SIGTERM

Trying to run Django also fails miserably.

[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1] mod_wsgi
(pid=26872): Target WSGI script '/usr/local/django/apache/django.wsgi'
cannot be loaded as Python module.
[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1] mod_wsgi
(pid=26872): Exception occurred processing WSGI script
'/usr/local/django/apache/django.wsgi'.
[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1]   File
"/usr/local/django/apache/django.wsgi", line 7, in <module>
[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1]     import
django.core.management
[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1]   File
"/usr/local/pythonenv/DJANGO-2/lib/python2.5/site-packages/Django-1.1.1-py2.5.egg/django/core/management/__init__.py",
line 3, in <module>
[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1]     from
optparse import OptionParser, NO_DEFAULT
[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1]   File
"/usr/local/python-2.6.5/frameworks/Python.framework/Versions/2.6/lib/python2.6/optparse.py",
line 77, in <module>
[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1]     import textwrap
[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1]   File
"/usr/local/python-2.6.5/frameworks/Python.framework/Versions/2.6/lib/python2.6/textwrap.py",
line 10, in <module>
[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1]     import string, re
[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1]   File
"/usr/local/python-2.6.5/frameworks/Python.framework/Versions/2.6/lib/python2.6/string.py",
line 528, in <module>
[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1]     from strop
import maketrans, lowercase, uppercase, whitespace
[Fri Apr 09 21:20:08 2010] [error] [client 127.0.0.1] SystemError:
dynamic module not initialized properly

So, they have obviously broken something in Python 2.6.5.

This was using Python 2.6.5 compiled from source code as fully fat and
running under 64 bit Apache on MacOS X (10.5).

Anyone using this combination?

Graham

On 9 April 2010 19:23, Graham Dumpleton <[email protected]> wrote:
> In Python 2.6.4 in Py_Main(), which is used by command line Python but
> not mod_wsgi, they had:
>
>        WaitForThreadShutdown();
>
>        Py_Finalize();
>
> In Python 2.6.5 they have made a change and now just have:
>
>        Py_Finalize();
>
> Then in Py_Finalize() they have no added.
>
>        wait_for_thread_shutdown();
>
> In mod_wsgi have explicit code which is commented as:
>
>    /*
>     * In Python 2.5.1 an exit function is no longer used to
>     * shutdown and wait on non daemon threads which were created
>     * from Python code. Instead, in Py_Main() it explicitly
>     * calls 'threading._shutdown()'. Thus need to emulate this
>     * behaviour for those versions.
>     */
>
> So, I had a workaround for them screwing with this stuff once before.
>
> Another comment before that is:
>
>    /*
>     * Because the thread state we are using was created outside
>     * of any Python code and is not the same as the Python main
>     * thread, there is no record of it within the 'threading'
>     * module. We thus need to access current thread function of
>     * the 'threading' module to force it to create a thread
>     * handle for the thread. If we do not do this, then the
>     * 'threading' modules exit function will always fail
>     * because it will not be able to find a handle for this
>     * thread.
>     */
>
> so, looks like I have code in there specifically to avoid what looks
> like a similar issue. I cant quickly see any changes which would cause
> that fixup to fail however.
>
> What is frankly annoying is that they do this sort of stuff in minor
> Python patch revisions. Thus if have to cope with this, need a change
> which can dynamically work no matter what patch revision of a specific
> major/minor version is used without having to force people to
> recompile if was first compiled against 2.6.4, but Python was since
> upgraded to 2.6.5.
>
> Also not happy that they are in effect changing externally visible
> behaviour, which although they compensate with it in command line
> Python, will stuff up anyone doing embedded Python work as it is
> changing what one expects Py_Finalize() to do.
>
> If this is an issue, am surprised it has taken almost a month since
> Python 2.6.5 was released for it to be brought up.
>
> Is anyone else using Python 2.6.5 yet? Are you seeing the same issue?
>
> I will have to do some more investigation and install 2.6.5 to play
> with. Will take me a few days or so depending on time I have.
>
> Graham
>
> On 9 April 2010 17:44, Dan Kamins <[email protected]> wrote:
>> I have also set in httpd.conf:
>> LogLevel debug
>>
>> And I have reduced to 4 processes for easier visibility of logs:
>> WSGIDaemonProcess myapp processes=4 threads=1 display-name=%{GROUP}
>>
>>
>> Here is the log from starting apache:
>>
>> [Fri Apr 09 07:41:12 2010] [notice] suEXEC mechanism enabled (wrapper: 
>> /usr/sbin/suexec)
>> [Fri Apr 09 07:41:12 2010] [info] mod_wsgi (pid=1087): Attach interpreter ''.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8702): mod_wsgi (pid=1087): 
>> Starting 1 threads in daemon process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8708): mod_wsgi (pid=1087): 
>> Starting thread 1 in daemon process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [info] mod_wsgi (pid=1091): Attach interpreter ''.
>> [Fri Apr 09 07:41:12 2010] [info] mod_wsgi (pid=1087): Enable deadlock 
>> thread in process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [info] mod_wsgi (pid=1087): Enable monitor thread 
>> in process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8542): mod_wsgi (pid=1087): 
>> Deadlock timeout is 300.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8545): mod_wsgi (pid=1087): 
>> Inactivity timeout is 0.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8702): mod_wsgi (pid=1091): 
>> Starting 1 threads in daemon process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8708): mod_wsgi (pid=1091): 
>> Starting thread 1 in daemon process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [info] mod_wsgi (pid=1091): Enable monitor thread 
>> in process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8542): mod_wsgi (pid=1091): 
>> Deadlock timeout is 300.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8545): mod_wsgi (pid=1091): 
>> Inactivity timeout is 0.
>> [Fri Apr 09 07:41:12 2010] [info] mod_wsgi (pid=1091): Enable deadlock 
>> thread in process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [info] mod_wsgi (pid=1092): Attach interpreter ''.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8702): mod_wsgi (pid=1092): 
>> Starting 1 threads in daemon process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8708): mod_wsgi (pid=1092): 
>> Starting thread 1 in daemon process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [info] mod_wsgi (pid=1092): Enable deadlock 
>> thread in process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [info] mod_wsgi (pid=1092): Enable monitor thread 
>> in process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8542): mod_wsgi (pid=1092): 
>> Deadlock timeout is 300.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8545): mod_wsgi (pid=1092): 
>> Inactivity timeout is 0.
>> [Fri Apr 09 07:41:12 2010] [info] mod_wsgi (pid=1099): Attach interpreter ''.
>> [Fri Apr 09 07:41:12 2010] [info] mod_wsgi (pid=1099): Enable deadlock 
>> thread in process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [info] mod_wsgi (pid=1099): Enable monitor thread 
>> in process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8542): mod_wsgi (pid=1099): 
>> Deadlock timeout is 300.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8545): mod_wsgi (pid=1099): 
>> Inactivity timeout is 0.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8702): mod_wsgi (pid=1099): 
>> Starting 1 threads in daemon process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [debug] mod_wsgi.c(8708): mod_wsgi (pid=1099): 
>> Starting thread 1 in daemon process 'myapp'.
>> [Fri Apr 09 07:41:12 2010] [notice] Apache/2.2.3 (CentOS) configured -- 
>> resuming normal operations
>>
>>
>>
>> Here is the log from stopping apache (immediately after starting) (see 3 
>> errors per process):
>>
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1099): Shutdown requested 
>> 'myapp'.
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1099): Stopping process 
>> 'myapp'.
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1099): Cleanup interpreter 
>> ''.
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1099): Terminating Python.
>> [Fri Apr 09 07:41:18 2010] [error] Exception KeyError: 
>> KeyError(47274411468128,) in <module 'threading' from 
>> '/usr/local/lib/python2.6/threading.pyc'> ignored
>> [Fri Apr 09 07:41:18 2010] [error] Exception KeyError: 
>> KeyError(47274411468128,) in <module 'threading' from 
>> '/usr/local/lib/python2.6/threading.pyc'> ignored
>> [Fri Apr 09 07:41:18 2010] [error] Exception KeyError: 
>> KeyError(47274411468128,) in <module 'threading' from 
>> '/usr/local/lib/python2.6/threading.pyc'> ignored
>> [Fri Apr 09 07:41:18 2010] [error] Exception KeyError: 
>> KeyError(47274411468128,) in <module 'threading' from 
>> '/usr/local/lib/python2.6/threading.pyc'> ignored
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1091): Shutdown requested 
>> 'myapp'.
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1091): Stopping process 
>> 'myapp'.
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1091): Cleanup interpreter 
>> ''.
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1087): Shutdown requested 
>> 'myapp'.
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1087): Stopping process 
>> 'myapp'.
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1087): Cleanup interpreter 
>> ''.
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1092): Shutdown requested 
>> 'myapp'.
>> [Fri Apr 09 07:41:18 2010] [error] Exception KeyError: 
>> KeyError(47274411468128,) in <module 'threading' from 
>> '/usr/local/lib/python2.6/threading.pyc'> ignored
>> [Fri Apr 09 07:41:18 2010] [error] Exception KeyError: 
>> KeyError(47274411468128,) in <module 'threading' from 
>> '/usr/local/lib/python2.6/threading.pyc'> ignored
>> [Fri Apr 09 07:41:18 2010] [error] Exception KeyError: 
>> KeyError(47274411468128,) in <module 'threading' from 
>> '/usr/local/lib/python2.6/threading.pyc'> ignored
>> [Fri Apr 09 07:41:18 2010] [error] Exception KeyError: 
>> KeyError(47274411468128,) in <module 'threading' from 
>> '/usr/local/lib/python2.6/threading.pyc'> ignored
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1092): Stopping process 
>> 'myapp'.
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1092): Cleanup interpreter 
>> ''.
>> [Fri Apr 09 07:41:18 2010] [error] Exception KeyError: 
>> KeyError(47274411468128,) in <module 'threading' from 
>> '/usr/local/lib/python2.6/threading.pyc'> ignored
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1087): Terminating Python.
>> [Fri Apr 09 07:41:18 2010] [error] Exception KeyError: 
>> KeyError(47274411468128,) in <module 'threading' from 
>> '/usr/local/lib/python2.6/threading.pyc'> ignored
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1091): Terminating Python.
>> [Fri Apr 09 07:41:18 2010] [info] mod_wsgi (pid=1092): Terminating Python.
>> [Fri Apr 09 07:41:18 2010] [error] Exception KeyError: 
>> KeyError(47274411468128,) in <module 'threading' from 
>> '/usr/local/lib/python2.6/threading.pyc'> ignored
>> [Fri Apr 09 07:41:18 2010] [error] Exception KeyError: 
>> KeyError(47274411468128,) in <module 'threading' from 
>> '/usr/local/lib/python2.6/threading.pyc'> ignored
>> [Fri Apr 09 07:41:18 2010] [notice] caught SIGTERM, shutting down
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "modwsgi" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/modwsgi?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to