Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Prevent duplicate composer controls from causing a publish hang#12916

Open
iampedropiedade wants to merge 1 commit into
concretecms:9.5.xfrom
iampedropiedade:fix/composer-duplicate-control-hang
Open

Prevent duplicate composer controls from causing a publish hang#12916
iampedropiedade wants to merge 1 commit into
concretecms:9.5.xfrom
iampedropiedade:fix/composer-duplicate-control-hang

Conversation

@iampedropiedade
Copy link
Copy Markdown
Contributor

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 of Control::getList() and calls publishToPage() for each. This triggers setAttribute() 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

  • Prevention: 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 a UserMessageException, preventing new duplicates from being created via the UI.
  • Mitigation: getList() now deduplicates results by a typeHandle:identifier key. This ensures that sites with pre-existing duplicate rows in PageTypeComposerFormLayoutSetControls are immediately protected from the hang without requiring a database migration.

How to Reproduce

  1. Go to Dashboard -> Pages & Themes -> Page Types -> [Any Type] -> Form.
  2. Add the same attribute twice (e.g., add "Navbar Style" to two different sets).
  3. Create a new page of that type via the composer and publish it.
  4. Observe that the request hangs indefinitely (504).

Note: Removing one of the duplicate controls resolves the hang immediately.

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]>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

2 participants