[Zope-dev] Re: RFC: Acquisition and __parent__ pointers

Hanno Schlichting plone at hannosch.info
Sun Jan 28 18:41:32 EST 2007


I had a few minutes to spare and took a quick look at the implementation.

Philipp von Weitershausen wrote:
> As for the implementation, I gave it my best shot in the
> philikon-aq-and-__parent__ branch. My experience with C is limited,
> especially when it comes to debugging. Help is therefore highly
> appreciated. There's a reward waiting for whoever fixes the problem and
> helps getting the branch merged to the trunk (see the proposal text).

I don't know any C (the only thing I ever did code in C was a simple
wrapper script to actually call Solaris assembler ;) but nonetheless I
thought I might be able to give some hints to the person that tries to
fix this.

Here's what I found regarding the segfault. All the segfaults come from
tests in Products.Five. The first one that dumped core for me was the
last test in Five/formlib/tests/formlib.txt in line 76.

After a bit of debugging I found that it actually fails while trying to
set a new object into a folder. As the folder where the object should be
set into is derived from OFS.Folder it will call
OFS.ObjectManager.checkValidId and fail on line 96 at:

obj = getattr(self, id, None)

My pdb session told me this:

(Pdb) self
<FiveTraversableFolder at /test_folder_1_/ftf>
(Pdb) id
(Pdb) self.objectIds()

But more importantly:

(Pdb) self.aq_chain
[<FiveTraversableFolder at /test_folder_1_/ftf>,
<Products.Five.metaclass.AddContentForm object at 0x30554d0>]

(Pdb) self.__parent__
<Products.Five.metaclass.AddContentForm object at 0x30554d0>
(Pdb) self.__parent__.__parent__
<FiveTraversableFolder at /test_folder_1_/ftf>
(Pdb) self.__parent__.__parent__.__parent__
<Products.Five.metaclass.AddContentForm object at 0x30554d0>

(Pdb) self.aq_parent
<Products.Five.metaclass.AddContentForm object at 0x30554d0>
(Pdb) self.aq_parent.aq_parent
*** AttributeError: aq_parent

So somehow the Acquisition chain got messed up and the getattr call gets
down into an infinite loop, which will cause the segfault after some time.

I hope this helps somebody to fix the actual problem,

More information about the Zope-Dev mailing list