[mod_python] Bizarre error wiping globals() under mod_python ...

Graham Dumpleton graham.dumpleton at gmail.com
Wed Jan 28 21:04:18 EST 2009

2009/1/29 Monsyne Dragon <mdragon at rackspace.com>:
> Ok, this is an odd one, any clues we can get would help.
> Environment mod_python 3.1.4 w/  python 2.4 on Ubuntu dapper

Upgrade to mod_python 3.3.1. That version is old and buggy. See:


for one possible source of your problems.

Secondly, remember that Apache is a multi process web server. Don't
expect globals you set in one process to be visible in another. See:



> We have a web app running under mod_python (it uses an obscure templating
> language/framework called PSE http://nick.borko.org/pse/)
> We are having an intermittent glitch which is truely bizarre.
> Periodically, one module deep in this large webapp is losing it's global
> namespace. On our production servers, this happens on random occasional
> basis, but we have replicated it on another machine. On that machine it was
> happening every other pagehit,
> and is now happening every pagehit except the first one after restarting
> apache (we don't know why this changed).
> This manifests in mindbenders like: we will import a module, (like 'sys')
> like so:
> import sys
> class SomeClass()
>   def __init__(self, args, go, here):
>         sys.stderr.write('Some message')
> This will run fine on the first hit, then subsequently will produce an
> exception saying that "'NoneType' object has no attribute 'stderr'" !!
> And it's not just 'sys' that that happens to. if we catch the exception and
> print the contents of globals() at that point, ALL of the modules imported,
> and any global variables  have their values  set to None!
> As far as we can tell, it is only happening to this one module in our
> (large,  hundreds of modules) codebase.  The module itself  is actually
> generated code, generated by the ZSI-2.0 SOAP library, and we've exercised
> this code from the command line hundreds of times without fail, running it
> in a loop.  It only fails like this in the mod_python environment, and then,
> not every time.
> Does anyone have an idea of where to even begin to figure this out?
> --
> --M. Dragon
> Confidentiality Notice: This e-mail message (including any attached or
> embedded documents) is intended for the exclusive and confidential use of
> the
> individual or entity to which this message is addressed, and unless
> otherwise
> expressly indicated, is confidential and privileged information of
> Rackspace.
> Any dissemination, distribution or copying of the enclosed material is
> prohibited.
> If you receive this transmission in error, please notify us immediately by
> e-mail
> at abuse at rackspace.com, and delete the original message.
> Your cooperation is appreciated.
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list