If keen to get rid of the KeyError message in logs, add the following
two lines just before the call to Py_Finalize() in mod_wsgi.c code.

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

Note that the error in the logs is harmless. These two lines just get
rid of it by devious means rather than adding a run time check as to
whether Python 2.6.5+ or Python 3.1.2+ is being used.

Graham

On 13 April 2010 21:07, Graham Dumpleton <[email protected]> wrote:
> On 13 April 2010 18:36, Thijs Triemstra | Collab <[email protected]> wrote:
>> I opened a ticket yesterday
>> (http://code.google.com/p/modwsgi/issues/detail?id=197) and I'm also looking
>> forward to any updates. My brand new cloud server with 3GB of RAM is brought
>> to it's knees after about 12 hours and I think it's due to this mod_wsgi /
>> Python 2.6.5 bug. That machine dies with the following error messages and
>> can only be brought back to live after a hard reboot:
>>
>> [62282.116349] Out of memory: kill process 3763 (apache2) score 176572 or a
>> child
>> [62282.116367] Killed process 8913 (apache2)
>>
>> [62340.321916] Out of memory: kill process 3763 (apache2) score 176297 or a
>> child
>> [62340.321935] Killed process 8943 (apache2)
>>
>> [62404.888786] Out of memory: kill process 3763 (apache2) score 176028 or a
>> child
>> [62404.888806] Killed process 8947 (apache2)
>>
>> I'm now going to see if things get better with Python 2.6.4 and report back.
>
> I still don't see that as related. Having checked through the Python
> 2.6.5 code, the KeyError message is noise only and not indicative of a
> serious problem.
>
> It comes about because shutdown of threading is now being done twice
> and on second time through, the very last line of code, which removes
> the current thread details for the set of threads fails because it was
> already done previously. It is being done twice because Python never
> used to do it for embedded Python but now it does. It isn't a simple
> matter of mod_wsgi not doing it as then you end up with ordering
> issues.
>
> Anyway, if you are having issues with processes not shutting down
> properly under 2.6.5, then it is likely a different issue.
>
> Graham
>
>> On 13 Apr 2010, at 02:38, Dan Kamins wrote:
>>
>> Great to hear.  We're still running with (and concerned about) this config,
>> so as soon as you have more information, please do update the list.
>>
>>
>> On Apr 12, 2010, at 6:29 PM, Graham Dumpleton wrote:
>>
>> Hooray, I have an environment set up where have been able to duplicate
>>
>> this now. :-)
>>
>> 2010/4/10 Evren Esat Özkan <[email protected]>:
>>
>> I'm getting same errors on CentOS with mod_wsgi-3.2, Python-2.6.5,
>>
>> Django trunk.  But my site working anyway...
>>
>>
>> WSGIDaemonProcess .......... processes=10 threads=10 inactivity-
>>
>> timeout=2000 maximum-requests=1000
>>
>>
>>
>> [Fri Apr 09 18:10:09 2010] [error] Exception KeyError:
>>
>> KeyError(-1209010416,) in <module 'threading' from '/opt/python2.6/lib/
>>
>> python2.6/threading.pyc'> ignored
>>
>> [Fri Apr 09 18:10:09 2010] [error] Exception KeyError:
>>
>> KeyError(-1209010416,) in <module 'threading' from '/opt/python2.6/lib/
>>
>> python2.6/threading.pyc'> ignored
>>
>> [Fri Apr 09 18:10:09 2010] [error] Exception KeyError:
>>
>> KeyError(-1209010416,) in <module 'threading' from '/opt/python2.6/lib/
>>
>> python2.6/threading.pyc'> ignored
>>
>>
>> Evren Esat Özkan
>>
>>
>> On 9 Nisan, 12:23, Graham Dumpleton <[email protected]>
>>
>> wrote:
>>
>>
>> Is anyone else using Python 2.6.5 yet? Are you seeing the same issue?
>>
>>
>> --
>>
>> 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.
>>
>>
>> --
>> 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.
>>
>

-- 
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