[ZODB-Dev] strange testConnection error

John Belmonte john at neggie.net
Mon Mar 14 21:44:03 EST 2005


Tim Peters wrote:
> 3. cPickle.Pickler() doesn't normally try to import copy_reg
>    anyway -- copy_reg is normally imported by cPickle's module
>    initialization code (which is why #2 died the way it did).
> 
>    There's one exception:  if you're in restricted execution mode,
>    then (and only then) cPickle.Pickler() tries to import copy_reg,
>    presumably under the theory that you may have changed the default
>    copy_reg.dispatch_table "for security reasons".  If sys.modules
>    was also fiddled "for security reasons", and no longer contained
>    copy_reg, and sys.path was fiddled so that copy_reg couldn't be
>    found anymore, then cPickle.Pickler() would die in the way shown.
> 
> #3 is the only path I can see that makes any sense at all here, but AFAIK
> ZODB/ZEO never provoke Python's restricted execution mode themselves.  Ring
> any bells wrt your code?  For example, are you using rexec or bastion, or
> fiddling module.__builtins__ in some module?

Thanks for the analysis Tim.  The situation has to be #3-- I know the 
import error is happening in a restricted mode, because that was part of 
the fight I had with the logging system.  The original error message was 
not seeing the light of day because an exception related to restricted 
mode was happening inside the logging module itself.  (In my opinion, if 
the logging system is that fragile, it's not very useful.)

If ZODB/ZEO isn't doing it, I don't know how restricted mode is getting 
invoked.  There's nothing like that in my app itself.  I'm fairly sure 
my app is not the problem, because the code was once working fine-- the 
problem began after some routine package upgrades on the machine.  I'll 
have to look to see if mod_python or Quixote might be causing it.

--John


More information about the ZODB-Dev mailing list