magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Attribute set edit form : slow or unfinished loading

Open ibrahim-amara opened this issue 1 year ago • 9 comments

Preconditions and environment

  • Magento version : 2.4.7 Magento Open source and Adobe Commerce
  • The bug is reproduced when you load the attribute set editor page for an attribute set, with an important number ( > 1000 ) of unassigned attributes to this attribute set
  • In this case the loading is really slow and takes a long time sometimes, and in some environment it does not even load the attributes, and this error is displayed :

image

There is the image of the loading of the page : image

Steps to reproduce

  1. Install Sample Data
  2. Create at least 1000 attributes ( not assigned to any of the attribute sets ) - please fin attached an example of a patch to create the attributes AddUnassignedAttributes.zip
  3. Go to Adobe commerce Backend
  4. Go so Stores > Attributes [Attribute Set] > Edit and attribute set ( Bag for example ) - Don't check the default attribute set

Expected result

The Editor should display in the same way of Adobe commerce 2.4.6, without the time that the loading takes or the error displayed

Actual result

The loader is displayed for a very long time, sometimes it displays the form and others it displays an error : image image

Additional information

After doing the technical check , the issue comes from the js jtree library that has been replaced in the 2.4.7 version in the file : vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml In the version 2.4.6 it was working

Release note

No response

Triage and priority

  • [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [X] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

ibrahim-amara avatar Jun 06 '24 20:06 ibrahim-amara

Hi @ibrahim-amara. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

m2-assistant[bot] avatar Jun 06 '24 20:06 m2-assistant[bot]

Hi @engcom-Dash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
    1. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

m2-assistant[bot] avatar Jun 07 '24 05:06 m2-assistant[bot]

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • [ ] 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • [ ] 5. Add label Issue: Confirmed once verification is complete.
  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Jun 18 '24 06:06 m2-assistant[bot]

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • [ ] 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • [ ] 5. Add label Issue: Confirmed once verification is complete.
  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Jun 19 '24 09:06 m2-assistant[bot]

Hello @ibrahim-amara,

Thank you for the report and collaboration!

We were not able to reproduce this on latest 2.4-develop instance. Followed the steps to reproduce and added 1000+ attributes. When opening Stores > Attributes [Attribute Set] > Edit an attribute set (Bag), we are able to see attribute list without any significant load time. image

Please let us know if we are missing anything.

Thank you.

engcom-November avatar Jun 19 '24 09:06 engcom-November

Hi @engcom-November I managed to reproduce the issue on my end with a fresh Magento 2.4.7-p1 With 1000 random attributes created, the loading time of this page is extremely long (screenshots below) :
Snipaste_2024-06-19_14-31-54 Snipaste_2024-06-19_14-28-42

and here's my script to create 1000 random attributes create_random_attributes.zip

weiweiouyang avatar Jun 19 '24 12:06 weiweiouyang

Hello @ibrahim-amara,

Thank you for the quick response!

Tried to reproduce this on 2.4.7-p1, but it is not reproducible. Here are the performance screenshots: image image

Here is the datapatch used to add 1000+ atrributes. I38810V.zip

Please let us know if we are missing anything.

Thank you.

engcom-November avatar Jun 24 '24 14:06 engcom-November

Hi @engcom-November,

This issue can only be reproduced when the attributes are located under Unassigned Attributes, while attributes created from the I38810V.zip will be assigned to a group after installation of the module (please see screenshot below) :

image

You may use my executable php script (paste it under the root folder of the project) to create 1000 unassigned attributes.

Feel free to contact me for any additional information.

Best regards,

weiweiouyang avatar Jun 24 '24 15:06 weiweiouyang

@ibrahim-amara,

The attributes were in unassigned attributes section when testing for the performance. Please take a look at the screenshot: image

I have double checked the issue with your script and got the same result.

engcom-November avatar Jun 25 '24 08:06 engcom-November

I am having the same issue. Firefox is crashing (2700 attributes in total)

dvolkering avatar Jul 08 '24 13:07 dvolkering

Same issue.

1. Environment Details: Magento Version: 2.4.7 PHP Version 8.3.7 Browser: Chrome version 120.0.6099.216

  1. Steps to Reproduce: Navigate to admin/catalog/product_set/edit/id/{attribute_set_id} Attempt to load the list of attributes.

  2. Expected Result: The page loads successfully, displaying the list of attributes for the product set.

  3. Actual Result: Chrome crashes, and the list of attributes fails to load.

sgr13 avatar Jul 12 '24 09:07 sgr13

Not able to reproduce this with 1000+ attributes on 2.4.7 and 2.4.7-p1 with php 8.3.8 and chrome version 126.0.6478.127.

Please take a look at the screencast below: ScreenRecording2024-07-12at6 23 07PM-ezgif com-video-to-gif-converter

Please let us know if there are any prerequisites required inorder to reproduce this.

engcom-November avatar Jul 12 '24 13:07 engcom-November

We're having the same problem after the update to 2.4.7-p1. The number of unassigned attributes is 1800.

The highest attribute ID is 24523. This might be (or might not) be of importance since I see the ID is used in JS: the first parameter of redraw_node and this number is probably higher than on a clean Magento instance.

It just keeps redrawing nodes forever, again and again. Screenshot 2024-07-22 at 11 03 44

xpoback avatar Jul 22 '24 09:07 xpoback

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • [ ] 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • [ ] 5. Add label Issue: Confirmed once verification is complete.
  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Nov 04 '24 11:11 m2-assistant[bot]

Hello @ibrahim-amara @xpoback,

We have tried to reproduce the issue in the latest 2.4-develop branch with the below script creating 3000 unassigned attributes.

<?php
use Magento\Framework\App\Bootstrap;
use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory;
use Magento\Eav\Setup\EavSetup;

require __DIR__ . '/app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();

/** @var AttributeFactory $attributeFactory */
$attributeFactory = $objectManager->get(AttributeFactory::class);

/** @var EavSetup $eavSetup */
$eavSetup = $objectManager->create(EavSetup::class);

$entityTypeId = $eavSetup->getEntityTypeId('catalog_product');
$attributeSetId = $eavSetup->getDefaultAttributeSetId($entityTypeId);

$attributeCodes = [];

for ($i = 1; $i <= 3000; $i++) {
    $attributeCode = 'random_attribute_' . $i;
    $attributeCodes[] = $attributeCode;

    $attributeData = [
        'type' => 'varchar',
        'label' => 'Random Attribute ' . $i,
        'input' => 'text',
        'required' => false,
        'user_defined' => true,
        'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
        'visible' => true,
        'searchable' => false,
        'filterable' => false,
        'comparable' => false,
        'visible_on_front' => false,
        'used_in_product_listing' => false,
        'unique' => false,
    ];

    try {
        $eavSetup->addAttribute($entityTypeId, $attributeCode, $attributeData);
        echo "Created attribute: $attributeCode\n";
    } catch (\Exception $e) {
        echo "Error creating attribute $attributeCode: " . $e->getMessage() . "\n";
    }
}

echo "Created 3000 random attributes.\n";

The issue has been reproducible for us:

image

Hence confirming the issue:

Thanks

engcom-Hotel avatar Nov 04 '24 11:11 engcom-Hotel

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-13304 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Nov 04 '24 11:11 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Nov 04 '24 11:11 m2-assistant[bot]

For several months, no one has been able to fix the bug that prevents viewing and managing attribute sets from the admin panel. There isn’t even the slightest information about what the problem might be.

For those interested: In a store with 3600+ attributes and around 500 attribute sets, the issue was resolved by overriding the file: vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml

with the code from Magento 2.4.6-p8: https://github.com/magento/magento2/blob/2.4.6-p8/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml

I assume the cause is this commit that replaced extjs with jstree: https://github.com/magento/magento2/commit/9eb7432c1d208565eeac373127a4ebcebd6f16e4

ssstankiewicz avatar Jan 10 '25 10:01 ssstankiewicz

For several months, no one has been able to fix the bug that prevents viewing and managing attribute sets from the admin panel. There isn’t even the slightest information about what the problem might be.

For those interested: In a store with 3600+ attributes and around 500 attribute sets, the issue was resolved by overriding the file: vendor/magento/module-catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml

with the code from Magento 2.4.6-p8: https://github.com/magento/magento2/blob/2.4.6-p8/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml

I assume the cause is this commit that replaced extjs with jstree: 9eb7432

I just created a patch for this and I just want to verify that this update works as expected. It is even faster then before.

fix_attributeset_screen_admin_2.4.7.txt

dvolkering avatar Jan 15 '25 10:01 dvolkering

Issue is fixed and here is the commit id: https://github.com/magento/magento2/commit/a7627fc4346638a1d10f4e18e7f438d8fca24c74

chittima avatar Mar 17 '25 18:03 chittima

Thanks for the update @chittima. I am closing this issue as the issue got fixed and merged with the repo.

engcom-Hotel avatar Mar 18 '25 07:03 engcom-Hotel