Problem/Motivation
Error: Maximum call stack size of 2048000 bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? in Drupal\Core\TypedData\TypedData->__sleep() (line 34 of core/lib/Drupal/Core/DependencyInjection/DependencySerializationTrait.php).
serialize() (Line: 14)
Drupal\Component\Serialization\PhpSerialize::encode() (Line: 120)
Drupal\Core\KeyValueStore\DatabaseStorageExpirable->doSetWithExpire() (Line: 131)
Drupal\Core\KeyValueStore\DatabaseStorageExpirable->setWithExpire() (Line: 143)
Drupal\Core\TempStore\PrivateTempStore->set() (Line: 76)
Drupal\layout_paragraphs\LayoutParagraphsLayoutTempstoreRepository->set() (Line: 60)
Steps to reproduce
This one is a bit tricky, you need hundreds of paragraphs_items, and the amount of bytes to process by the serialize also needs to be high. This will cause the in memory references of the $layout_paragraphs_layout to bloat while serialize is trying to handle the recursion loops and crash.
Proposed resolution
remove these recursive references before saving in LayoutParagraphsLayoutTempstoreRepository::set()
Issue fork layout_paragraphs-3599833
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
andras_szilagyi commentedThe version is 2.1.x because thats what I'm using but I might try to upgrade later to check results.
Comment #4
saidatomLooks good, moving to RTBC.
Comment #5
saidatomunsetting _referringItem on the live paragraph objects; fixed by re-linking them after the tempstore write and read.
Comment #6
alorencThe pipeline failed for the latest changes, so it’s difficult to say whether everything is working correctly.
Comment #7
alorencComment #8
saidatomThe test failures are pre-existing and unrelated to this change — they're caused by the missing #[RunTestsInSeparateProcesses]
Comment #9
alorencComment #10
alorencVery likely, this work will conflict with #3611711
Comment #12
alorencCreated the 3599833-3.0.x-maximum-call-stack branch and cherry-picked the changes from the other branch to check the test results.
Comment #14
alorencComment #15
alorencReordering components left each paragraph pointing at the wrong field item. Those wrong pointers chained all the paragraphs together, so saving the layout recursed through every paragraph and ran out of stack on big pages.
The fix updates the pointers after each reorder.
Comment #16
alorencComment #17
alorencComment #19
dimilias commentedTested on the UI and the code looks fine. +1 RTBC.