Commit of 3180541 leads to out of memory error

Created on 31 March 2023, over 1 year ago

Describe your bug or feature request.

Since the commit of 🐛 Product Variation is without context in view based listing of Products when using Layout builder for managing product display Needs review we run into out of memory errors after on many pages as soon as 'layout_builder.sample_entity' temp store becomes invalid or gets deleted.

The current implementation triggers the product variation sample value generation on totally unrelated pages that don't use the layout builder and that don't deal with products and variations at all.

In that case no runtime context for product variations could be detected, which is correct. So "$value" is NULL which leads to get this new code executed on pages that are totally unrelated to commerce

    // For empty $value create the dummy one.
    if ($value === NULL) {
      if ($this->sampleEntityGenerator !== NULL) {
        $value = $this->sampleEntityGenerator->get('commerce_product_variation', reset($variation_types));
      }
      else {
        $value = $product_variation_storage->create([
          'type' => reset($variation_types),
        ]);
      }
    }

In our case with lots of plugins and contrib modules the sample value generation in a kind of undefined context then leads to out of memory and the page could never be loaded successfully unless a sample value has been created elsewhere.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Product

Created by

🇩🇪Germany mkalkbrenner 🇩🇪

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

Comments & Activities

Production build 0.71.5 2024