Prevent duplicate composer controls from causing a publish hang#12916
Open
iampedropiedade wants to merge 1 commit into
Open
Prevent duplicate composer controls from causing a publish hang#12916iampedropiedade wants to merge 1 commit into
iampedropiedade wants to merge 1 commit into
Conversation
Adding the same attribute/block/property twice to a page type composer form causes a MySQL deadlock on publish: saveForm() calls setAttribute() twice for the same (cID, cvID, akID), which hangs indefinitely resulting in a 504 Gateway Timeout. - addToPageTypeComposerFormLayoutSet() now throws a UserMessageException if the same control type+identifier already exists in any set for the page type, preventing duplicates from being added via the UI. - getList() now deduplicates by typeHandle:identifier as a safety net for sites that already have duplicate controls in the database. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Adding the same attribute (or block/core page property) twice to a page type's composer form causes a hang on publish, resulting in a 504 Gateway Timeout.
When a duplicate control exists,
saveForm()iterates the result ofControl::getList()and callspublishToPage()for each. This triggerssetAttribute()twice for the same(cID, cvID, akID)combination on the same database connection, causing a MySQL deadlock / indefinite wait.While collection attributes are the most dangerous case, the bug is not specific to any single attribute type. It can be triggered by any control type added more than once across any sets of the same page type.
Fix
addToPageTypeComposerFormLayoutSet()now checks whether a control with the same type handle and identifier already exists in any set for the page type before inserting. If a duplicate is found, it throws aUserMessageException, preventing new duplicates from being created via the UI.getList()now deduplicates results by atypeHandle:identifierkey. This ensures that sites with pre-existing duplicate rows inPageTypeComposerFormLayoutSetControlsare immediately protected from the hang without requiring a database migration.How to Reproduce
Note: Removing one of the duplicate controls resolves the hang immediately.