Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Preserve ZCA site for transaction hooks that depend on it #63

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rpatterson
Copy link
Member

The zope.component site should not be cleared before committing transacions
in case any transaction hooks depend on it.

In the test in which I ran into this issue, the transaction.commit() failed
because the indexing queue was processing a
plone.app.blocks.indexing.LayoutSearchableText indexer at commit-time that
was trying to lookup a plone.app.blocks.layoutbehavior.ILayoutAware adapter.
Since that adapter depends on behavior-derived interfaces,
plone.dexterity.schema looks up a plone.dexterity.interfaces.IDexterityFTI
utility for the portal_type which fails if the site isn't set which in turn
yields no behavior interfaces which in turn makes the behavior-based adapter
lookup fail.

In my case, this wasn't even the symptom observed. Because the commit failed
silently, the changes from applying the GS profile weren't persisted
including, in my case, a custom theme browser layer registration which in turn
meant a custom browser view lookup failed. IOW, this silent commit failure
can lead to any number of very surprising, very wrong, and hard to diagnose
behaviors.

I'm not sure what changed or when, but this test worked under Python 2.7 and
Plone 5.1 and I'm fairly confident that nothing changed in the testing code on
"my" side that caused this and that the root change in behavior is somehow on
the Plone side of things.


The `zope.component` site should not be cleared before committing transacions
in case any transaction hooks depend on it.

In the test in which I ran into this issue, the `transaction.commit()` failed
because the indexing queue was processing a
`plone.app.blocks.indexing.LayoutSearchableText` indexer at commit-time that
was trying to lookup a `plone.app.blocks.layoutbehavior.ILayoutAware` adapter.
Since that adapter depends on behavior-derived interfaces,
`plone.dexterity.schema` looks up a `plone.dexterity.interfaces.IDexterityFTI`
utility for the `portal_type` which fails if the site isn't set which in turn
yields no behavior interfaces which in turn makes the behavior-based adapter
lookup fail.

In my case, this wasn't even the symptom observed.  Because the commit failed
silently, the changes from applying the GS profile weren't persisted
including, in my case, a custom theme browser layer registration which in turn
meant a custom browser view lookup failed.  IOW, this silent commit failure
can lead to any number of very surprising, very wrong, and hard to diagnose
behaviors.

I'm not sure what changed or when, but this test worked under Python 2.7 and
Plone 5.1 and I'm fairly confident that nothing changed in the testing code on
"my" side that caused this and that the root change in behavior is somehow on
the Plone side of things.
@mister-roboto
Copy link

@rpatterson thanks for creating this Pull Request and help improve Plone!

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass.

Whenever you feel that the pull request is ready to be tested, either start all jenkins jobs pull requests by yourself, or simply add a comment in this pull request stating:

@jenkins-plone-org please run jobs

With this simple comment all the jobs will be started automatically.

Happy hacking!

@rpatterson
Copy link
Member Author

@jenkins-plone-org please run jobs

@rpatterson
Copy link
Member Author

I can't understand how the CI failures are related to my changes and I don't have the time to dig deeper. Hopefully this can get merged but if not at least it's here for others having the same problem to reference.

@tisto
Copy link
Member

tisto commented Jan 7, 2020

@rpatterson Jenkins aborted the jobs after three hours. Our Jenkins instance is super slow right now, so this has nothing to do with your PR as far as I can see. If you have time, try to re-run the Jenkins job when there is low traffic on Jenkins. Sorry for the inconvenience!

@rpatterson
Copy link
Member Author

@jenkins-plone-org please run jobs

1 similar comment
@ale-rt
Copy link
Member

ale-rt commented Jan 27, 2020

@jenkins-plone-org please run jobs

@jensens
Copy link
Member

jensens commented May 12, 2022

Is this still a thing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants