magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.48k stars 9.29k forks source link

Magento 2.1 RC1: product catalog in backend cannot be displayed #4695

Closed bh-ref closed 8 years ago

bh-ref commented 8 years ago

Steps to reproduce

  1. Install Magento Magento 2.1 RC1.
  2. In backend, go to Product -> Catalog.

    Expected result

  3. List of products appears.

    Actual result

  4. The following error appears: Warning: DOMDocumentFragment::appendXML(): Entity: line 1: parser error : CData section too big found in /magento/lib/internal/Magento/Framework/View/TemplateEngine/Xhtml/Template.php on line 60
  5. I dumped the content into a file, it took 27 MB of disk space. If DOMDocumentFragment::appendXML() is using libxml2, then it may be the problem that XML_MAX_TEXT_LENGTH is usually compiled to around 10 MB as this suggests: http://php.net/manual/de/domdocument.loadxml.php#113676

image

bh-ref commented 8 years ago

Sorry, seems to be a problem with an extension (I just disabled all non-Magento modules and the problem is gone).

ghost commented 7 years ago

What extensions are you running. I had this issue after I ran the migration script.

Currently I have "sjparkinson/static-review": "~4.1", "classyllama/module-avatax": "^0.3.3", "subscribepro/subscribepro-magento2-ext": "^1.0", "magefan/module-login-as-customer": "^2.1", "ibnab/magento2-delete-orders": "*", "customerparadigm/ordercomments": "^100.0", "amasty/base": "^1.0", "amasty/module-mass-order-actions": "^1.0", "amasty/preorder": "^1.0", "magento/data-migration-tool": "2.1.3", "weltpixel/maxmind": "^1.0", "weltpixel/m2-weltpixel-backend": "^1.0", "magestore/giftvoucher-magento2": "^1.0", "magestore/rewardpoints-magento2": "^1.0"

bh-ref commented 7 years ago

As far as I can see, the only matching extension which was activated at that time was "amasty/base".

Maybe it helps to disable all the extension, let the list of products appear, and then reenable the extension (maybe one by one)?

ghost commented 7 years ago

I tried removing all my extensions and no luck I didn't have this issue until I did a migration from mage 1. I had all my extensions installed before I migrated over.

bh-ref commented 7 years ago

I tried to raise the limit for appendXML() back then as well. Without success, too. Maybe you can create a copy of your database, delete half of the products, check, and if the problem still exist, create another copy and delete the other half of the products. If one half of the products produces the error, continue to half the products further until you manage to find the product which produces this issue (if it is a product which produces the issue). Just my guess, I really do not know what to do else, I am sorry. Maybe the best idea is to open a new ticket?

ghost commented 7 years ago

Well I am wondering why the xml is even needed it's just holding a json object.

<script type="text/x-magento-init"><![CDATA[{"*": [{"junk":"25mb of junk"}]}]]></script>

There is allot of junk code wrapping this. I think the proper solution would be to make this a literal object. Its just a ton of unneeded bloat causing a performance bottle kneck for what? To make this break after to many records?

<script>
var tmpObject = {"*": [{"junk":"25mb of junk"}]};
</script>
ghost commented 7 years ago

I created this ticket. https://github.com/magento/magento2/issues/8084

ghost commented 7 years ago

@bh-ref check out my link I made a grid that works! on ticket 8084

bh-ref commented 7 years ago

@joshspivey cool, I am glad you found a working solution / fix! I just realize now that you have problems with the sales/order grid, whereas I was having trouble with the product grid. But maybe your fix is easily applicable for that as well. In my installation, the problem is not appearing anymore, but it sure is good to know there is an alternative available.

ghost commented 7 years ago

@bh-ref yah you have to much product data. If its making a XML file over 10mb you will have this issue. All the grids on Mage 2 load all XML at once which is not good if you have allot of data on any part of the site. I chose to use backbone grid because the knockout grids didn't have anything close the functionality as backgrid and I don't want to spend months working on a fix for something that takes a couple days to make. The grid script built in mage 2 looked like they tried to roll there own and was very minimal at best. It needs a lot of functionality.

You can change it out to products in a couple of hours.

in https://github.com/joshspivey/magento2-sales-grid/blob/master/Controller/Adminhtml/Orders/OrderList.php

just swap out \Magento\Sales\Api\OrderRepositoryInterface $orderRepository, to product repo and SortOrderBuilder to SortProductBuilder

Then in https://github.com/joshspivey/magento2-sales-grid/blob/master/view/adminhtml/web/js/magentoGrid.js

update your columns to match the data

 var processGrid = {
            columns: [
                {

                    name: 'entity_id',
                    label: 'Order ID',
                    editable: false,
                    cell: Backgrid.IntegerCell.extend({
                        orderSeparator: ''
                    })
                }, 
                {
                    name: 'increment_id',
                    label: 'Increment ID',
                    editable: false,
                    cell: Backgrid.IntegerCell.extend({
                        orderSeparator: ''
                    })
                },
                {
                    name: 'status',
                    label: 'Status',
                    editable: false,
                    cell: 'string'
                }, 
                {
                    name: 'created_at',
                    label: 'Created At',
                    editable: false,
                    cell: timeDateFormat
                },
                {
                    name: 'updated_at',
                    label: 'Updated At',
                    editable: false,
                    cell: timeDateFormat
                },
                {
                    name: 'base_grand_total',
                    label: 'Base Grand Total',
                    editable: false,
                    cell: 'string'
                },
                {
                    name: 'base_total_paid',
                    label: 'Base Total Paid',
                    editable: false,
                    cell: 'string'
                }, 
                {
                    name: 'customer_email',
                    label: 'Customer Email',
                    editable: false,
                    cell: 'string'
                }
            ]
        };

There are some other minor tweaks needed.

Then to get it to show up on the product menu

edit https://github.com/joshspivey/magento2-sales-grid/blob/master/etc/adminhtml/menu.xml

change Magento_Sales::sales_operation to the products section

ecomwise commented 7 years ago

We had same a problem with orders grid. It contained around 15000 records. Issue occured when sales_order_grid.xml massAction component was extended in our custom Module. So if third party module is adding custom mass action to gird and grid has a lot of records, probably this error will appear. In our example in order grid, without custom mass action CData was 52Kb. When custom mass action enabled, CData raised to 22Mb