[Zope] Re: URGENT: Can't start up zope

Jay, Dylan djay@lucent.com
Tue, 15 Jun 1999 11:15:48 +1000


> -----Original Message-----
> From: Jim Fulton [mailto:jim@digicool.com]
> Sent: Saturday, June 12, 1999 21:54
> To: Jay, Dylan
> Cc: 'zope@zope.org'; 'support@digicool.com'
> Subject: Re: [Zope] Re: URGENT: Can't start up zope
> 
> 
> "Jay, Dylan" wrote:
> > 
> > > -----Original Message-----
> > > From: Michel Pelletier
> > > Sent: Friday, June 11, 1999 2:42 PM
> > > To: 'djay@lucent.com'; zope@zope.org
> > > Cc: Support
> > > Subject: RE: URGENT: Can't start up zope.
> > >
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Dylan Jay [mailto:djay@cse.unsw.edu.au]
> > > > Sent: Friday, June 11, 1999 2:29 PM
> > > > To: zope@zope.org
> > > > Cc: support@digicool.com
> > > > Subject: URGENT: Can't start up zope.
> > > >
> > > >
> > > > I was doing some external method work on our production
> > > > server (silly boy)
> > > > and something went very wrong. Every time I start zope it
> > > > will crash. This
> > > > is both as an NT service and using ZHTTPServer. ZHTTPServer
> > > > gives a stack
> > > > dump that mentions initializing products and factories and stuff
> > > > (unfortunatly my office has a power outage currently so I
> > > > can't the dump
> > > > or the data.bbb until 5 hours or so). Using the bbb.py 
> it reports no
> > > > corruptions so I can only presume the database contains some
> > > > configurations that screws up zope. To make matters worse our
> > > > expensive
> > > > backup solution doesn't seem to have backed up data.bbb.
> > > >
> > >
> > > Can you send us this traceback?  Did a power outage occour
> > > while the server was running?  Did the machine not get shut
> > > down properly and this this problem happened?  Or did it just
> > > happen after a clean shutdown (ie, what was the state of the
> > > server before coming up the first time with this error).
> > 
> > No, It occured while testing an external method.
> > 
> > Heres the dump
> > 
> > C:\Program Files\Provision>..\python\python serve.py
> > Traceback (innermost last):
> >   File "serve.py", line 100, in ?
> >     ZopeHTTPServer.main(args)
> >   File "C:\Program 
> Files\Provision\ZopeHTTPServer\ZopeHTTPServer.py", line
> > 498,
> > in main
> >     start(module_file,host,port,threading,env)
> >   File "C:\Program 
> Files\Provision\ZopeHTTPServer\ZopeHTTPServer.py", line
> > 436,
> > in start
> >     set_published_module(module_file,BoboRequestHandler,env)
> >   File "C:\Program 
> Files\Provision\ZopeHTTPServer\ZopeHTTPServer.py", line
> > 432,
> > in set_published_module
> >     __import__(name) # to catch problem modules right away
> >   File "C:\Program Files\Provision\lib\python\Main.py", 
> line 103, in ?
> >     Bobobase=OFS.Application.open_bobobase()
> >   File "C:\Program 
> Files\Provision\lib\python\OFS\Application.py", line 371,
> > in
> > open_bobobase
> >     install_products(app)
> >   File "C:\Program 
> Files\Provision\lib\python\OFS\Application.py", line 486,
> > in
> > install_products
> >     App.Product.initializeProduct(product, product_name, 
> package_dir, app)
> >   File "C:\Program 
> Files\Provision\lib\python\App\Product.py", line 428, in
> > init
> > ializeProduct
> >     if old is not None: products._delObject(name)
> >   File "C:\Program 
> Files\Provision\lib\python\App\Product.py", line 145, in
> > _del
> > Object
> >     for factory in getattr(self, id)._factories(): 
> factory._unregister()
> > AttributeError: _factories
> 
> Change this loop in Product.py to:
> 
>         try:
>             for factory in getattr(self, id)._factories():
>                 factory._unregister()
>         except: pass
> 
> The product is broken, so you can't get at it's factories
> (or figure out that it has none, in this case.
> > 
> > Now that I've had some time to debug it a little, what I 
> discover is this.
> > The above crash happens while trying to initialize the 
> MailHost object. The
> > reason is that getattr(self,id) in the call above is 
> actually a DTML object
> > not a Factory object. Somehow a piece of code got whacked 
> in the wrong
> > place.
> 
> That seems strange.
> 
> Where was the ExternalMethod you were messing with? 
> What did it do?


Heres the the methods. Its designed so I can not show a link if the user
doesn't have permission view it. This will allow things my dynamic site map
to be relvent to the current user.

from AccessControl.Permission import Permission
import string


def canViewObj(SomeObject, userRoles):
  if hasattr(SomeObject,'_View_Permission'):
    Roles = getattr(SomeObject,'_View_Permission')
    if 'Anonymous' in Roles:
      return 1
    else:
      for i in userRoles:
        if i in Roles:
          return 1
      # ok, try parents
      if SomeObject.acquiredRolesAreUsedBy('View') != '':
        return canViewObj(SomeObject.aq_parent, userRoles)
  else:
    return canViewObj(SomeObject.aq_parent, userRoles)
      

def canView(self, objName, AUTHENTICATED_USER):
  return 1
  #return AUTHENTICATED_USER.getRoles()
  objName = 'self.'+string.replace(objName,'/','.')
  objName = string.replace(objName,'..','.')
  SomeObject = eval(objName)
  return canViewObj(SomeObject, AUTHENTICATED_USER.getRoles())
  


def test(self, objName):
  #return objName.getRoles()
  objName = 'self.'+string.replace(objName,'/','.')
  objName = string.replace(objName,'..','.')
  SomeObject = eval(objName)
  if hasattr(SomeObject,'_View_Permission'):
    return 'blah'
  return canViewObj(SomeObject,['Customer', 'Developer', 'Manager'])

-----------------------
    
I'm not sure that this caused the problem but it was what I was working on
at the time. I have a feeling that the problem may have been caused days
earlier. What I think happened is I did something to crash zope and then the
problem with initilization surfaced when I tried to reload. I think I even
saw something called a principia factory sitting in another section of the
site so that and the MailHost must have got transposed. 


   

> 
> > I can now get the site up by removing the MailHost product. 
> However mail is
> > an extermely important part of the site in that no new user 
> can register
> > without it. When a shut it down and add MailHost back in I 
> get the same
> > problem. What I need to do is somehow take out what is posing as the
> > MailHost Product. I have no idea how to do this.
> > 
> > I will resend this mail to digicool.com with my database
> 
> I'd definiately like to look at it.
> 
> In the mean time, see if the code change above fixes the
> problem.

I did something similar before I got this message and managed to fix the
problem. I sent my ODB to support@digicool.com but its 10M zipped and it
bounced. I will forward it to you now.