sankarNarayanan / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

KeyError in module 'threading' with Python 2.6.5 #197

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When we built Python, we did not set a --prefix, but did only: 
$ ./configure --enable-shared 
$ make 
$ sudo make install 

Apache/2.2.11 (Ubuntu) DAV/2 SVN/1.6.9 PHP/5.2.6-3ubuntu4.5 with Suhosin-Patch 
mod_ssl/2.2.11 
OpenSSL/0.9.8g mod_wsgi/3.2 Python/2.6.5

Python version:
CPython 2.6.5 (r265:79063, Mar 26 2010, 20:29:33) [GCC 4.3.3]
#6 SMP Thu Mar 11 14:32:05 UTC 2010

Linux version:
Linux host.domain.com 2.6.32.9-rscloud #6 SMP Thu Mar 11 14:32:05 UTC 2010 
x86_64 GNU/Linux

ldd /usr/lib/apache2/modules/mod_wsgi.so:
    linux-vdso.so.1 =>  (0x00007fff9f9ff000)
    libpython2.6.so.1.0 => /usr/local/lib/libpython2.6.so.1.0 (0x00007f89b3257000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00007f89b303b000)
    libdl.so.2 => /lib/libdl.so.2 (0x00007f89b2e36000)
    libutil.so.1 => /lib/libutil.so.1 (0x00007f89b2c33000)
    libm.so.6 => /lib/libm.so.6 (0x00007f89b29ae000)
    libc.so.6 => /lib/libc.so.6 (0x00007f89b263b000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f89b384c000)

Here is the log from apache:
[Mon Apr 12 11:11:46 2010] [error] Exception KeyError: 
KeyError(139934492751712,) in <module 'threading' 
from '/usr/local/lib/python2.6/threading.pyc'> ignored
[Mon Apr 12 11:11:48 2010] [error] Exception KeyError: 
KeyError(139934492751712,) in <module 'threading' 
from '/usr/local/lib/python2.6/threading.pyc'> ignored
[Mon Apr 12 11:11:49 2010] [error] Exception KeyError: 
KeyError(139934492751712,) in <module 'threading' 
from '/usr/local/lib/python2.6/threading.pyc'> ignored
[Mon Apr 12 11:11:50 2010] [error] Exception KeyError: 
KeyError(139934492751712,) in <module 'threading' 
from '/usr/local/lib/python2.6/threading.pyc'> ignored
[Mon Apr 12 11:11:52 2010] [error] Exception KeyError: 
KeyError(139934492751712,) in <module 'threading' 
from '/usr/local/lib/python2.6/threading.pyc'> ignored
[Mon Apr 12 11:11:53 2010] [error] Exception KeyError: 
KeyError(139934492751712,) in <module 'threading' 
from '/usr/local/lib/python2.6/threading.pyc'> ignored
[Mon Apr 12 11:11:56 2010] [error] Exception KeyError: 
KeyError(139934492751712,) in <module 'threading' 
from '/usr/local/lib/python2.6/threading.pyc'> ignored
[Mon Apr 12 11:11:57 2010] [error] Exception KeyError: 
KeyError(139934492751712,) in <module 'threading' 
from '/usr/local/lib/python2.6/threading.pyc'> ignored
[Mon Apr 12 11:11:58 2010] [error] Exception KeyError: 
KeyError(139934492751712,) in <module 'threading' 
from '/usr/local/lib/python2.6/threading.pyc'> ignored
[Mon Apr 12 11:11:59 2010] [error] Exception KeyError: 
KeyError(139934492751712,) in <module 'threading' 
from '/usr/local/lib/python2.6/threading.pyc'> ignored

Original issue reported on code.google.com by thijs.triemstra@gmail.com on 12 Apr 2010 at 11:26

GoogleCodeExporter commented 8 years ago
Also, when I restart Apache it shows lots of broken processes:

[Mon Apr 12 11:25:01 2010] [warn] child process 18187 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:01 2010] [warn] child process 18188 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:01 2010] [warn] child process 17924 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:01 2010] [warn] child process 17931 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:01 2010] [warn] child process 17934 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:01 2010] [warn] child process 17224 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:01 2010] [warn] child process 17817 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:01 2010] [warn] child process 17818 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:01 2010] [warn] child process 17950 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:03 2010] [warn] child process 18187 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:03 2010] [warn] child process 18188 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:03 2010] [warn] child process 17924 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:03 2010] [warn] child process 17931 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:03 2010] [warn] child process 17934 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:03 2010] [warn] child process 17224 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:03 2010] [warn] child process 17817 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:03 2010] [warn] child process 17818 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:03 2010] [warn] child process 17950 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:05 2010] [warn] child process 18187 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:05 2010] [warn] child process 17924 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:05 2010] [warn] child process 17931 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:05 2010] [warn] child process 17934 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:05 2010] [warn] child process 17224 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:05 2010] [warn] child process 17817 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:05 2010] [warn] child process 17818 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:05 2010] [warn] child process 17950 still did not exit, 
sending a SIGTERM
[Mon Apr 12 11:25:07 2010] [error] child process 18187 still did not exit, 
sending a SIGKILL
[Mon Apr 12 11:25:07 2010] [error] child process 17924 still did not exit, 
sending a SIGKILL
[Mon Apr 12 11:25:07 2010] [error] child process 17931 still did not exit, 
sending a SIGKILL
[Mon Apr 12 11:25:07 2010] [error] child process 17224 still did not exit, 
sending a SIGKILL
[Mon Apr 12 11:25:07 2010] [error] child process 17817 still did not exit, 
sending a SIGKILL
[Mon Apr 12 11:25:07 2010] [error] child process 17950 still did not exit, 
sending a SIGKILL
[Mon Apr 12 11:25:08 2010] [notice] SIGHUP received.  Attempting to restart

Original comment by thijs.triemstra@gmail.com on 12 Apr 2010 at 11:28

GoogleCodeExporter commented 8 years ago
This has also been reported for CentOS on the mailinglist: 
http://groups.google.com/group/modwsgi/browse_thread/thread/ba82b2643564d2dd/1a4
3981dfdd4510b?

Original comment by thijs.triemstra@gmail.com on 12 Apr 2010 at 11:29

GoogleCodeExporter commented 8 years ago
The KeyError in itself should be harmless and so far hadn't been any indication 
that other problems were 
occurring. If the processes themselves are also hanging on shutdown, that is 
more of an issue.

Short story is that they have changed the embedded behaviour of Python in 
2.6.5, partly returning some 
behaviour that they had fiddled with back in Python 2.5.1 which mod_wsgi had to 
provide a work around for to 
ensure things still worked as required. The work around may be causing an 
action to occur twice in 2.6.5 now 
because of their further changes. Not sure if this is causing the problems.

Cant even get Python 2.6.5 to completely work properly on MacOS X 10.5 
(Leopard), but to the extent that can, 
cant duplicate the issue. Still need to try MacOS X 10.6 (Snow Leopard).

Original comment by Graham.Dumpleton@gmail.com on 12 Apr 2010 at 11:45

GoogleCodeExporter commented 8 years ago

Original comment by Graham.Dumpleton@gmail.com on 12 Apr 2010 at 11:45

GoogleCodeExporter commented 8 years ago
The message is harmless. Fix added in revision 1588 of subversion trunk for 
mod_wsgi 4.0 to get rid of it anyway.

If want to get rid of it in older versions of mod_wsgi, find call to 
Py_Finalize() and add immediately before that:

    if (!PyImport_AddModule("dummy_threading"))
        PyErr_Clear();

This is enough to get Python threading module to ignore the error rather than 
re raise the error causing the 
message to be logged.

Will be back ported to mod_wsgi 2.X and 3.X only if bug fix versions of those 
need to be released for more serious 
reasons.

Note that this issue also affects Python 3.1.2 and later in 3.X series.

Original comment by Graham.Dumpleton@gmail.com on 16 Apr 2010 at 12:23

GoogleCodeExporter commented 8 years ago
Turns out this was a harmless message indeed, thanks for the follow up, cheers.

Original comment by thijs.triemstra@gmail.com on 19 Apr 2010 at 6:47

GoogleCodeExporter commented 8 years ago
Backport to mod_wsgi 3.X branch for 3.3 in revision 1605.

Original comment by Graham.Dumpleton@gmail.com on 12 Jul 2010 at 2:03

GoogleCodeExporter commented 8 years ago
Version 3.3 has been released.

Original comment by Graham.Dumpleton@gmail.com on 31 Jul 2010 at 10:39