Out of memory when attempting to use Layout Builder (includes workaround)

Created on 19 June 2023, over 1 year ago

Problem

When using Section Library, attempting to go to the Layout tab of certain nodes may cause an out of memory error.

Steps to reproduce

This was not always reproducible in our site, but it was consistently reproducible for a certain node. It did not seem to be related to the number of sections in the library, as it still happened after deleting all of the sections from the library.

Workaround

We did not delve into the Section Library code. Because the Section Library module is so valuable for our content editors, and we were on a deadline, we elected to try to workaround this issue. We followed the advice in https://acquia.my.site.com/s/article/360004542293-Conditionally-increasi.... Increasing the memory limit for the node layouts solved the problem. (Note that care must be taken when increasing memory limits).

We used this code snippet in settings.php to increase memory for Layout Builder:

$admin_paths = array(
    'admin',
    'node/%node/layout',
    'section_library/import'
  );

  // standardize node layout paths for validation
  $current_path = preg_replace("/\d+/", '%node', $uri);

  foreach ($admin_paths as $admin_path) {
    if (strpos($current_path, $admin_path) !== false) {
      ini_set('memory_limit', '256M');
    }
  }
πŸ› Bug report
Status

Active

Version

1.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States JWBrown

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024