If you run in out-of-memory (OOM) errors during the product image import, chances are you are running into a bug in Magento regarding image conversion during CSV imports.
In the Magento admin backend, it appears as if your
csv import is still running, but in the error logs you’ll notice errors that appeared during the import.
recv() failed (104: Connection reset by peer) while reading response header from upstream
In the access logging a
502 status code is returned.
This error is caused by a bug in the
Gd2.php library Magento uses to convert image formats.
To fix this issue, use the instructions to fix this bug.
Instructions for manual repair
- Create the new destination for this file:
1mkdir -p /data/web/public/app/code/local/Varien/Image/Adapter
- Copy the
Gd2.phpfile to it’s destination:1cp /data/web/public/lib/Varien/Image/Adapter/Gd2.php /data/web/public/app/code/local/Varien/Image/Adapter/Gd2.php
/data/web/public/app/code/local/Varien/Image/Adapter/Gd2.phpwith your favorite editor:1sensible-editor /data/web/public/app/code/local/Varien/Image/Adapter/Gd2.php
- Go to
register_shutdown_functionon line 49 and change this line:
To:1// register_shutdown_function(array($this, 'destruct'));
- Keep the file open in your editor, and change line 55:
From:1public function destruct()
To:1public function __destruct()
This should lower the memory of the image resize functionality drastically.