Skip to content

Image resize queue error due to .tmp file handling when deleting unsaved product images #39146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kapilpandya2203 opened this issue Sep 6, 2024 · 9 comments · May be fixed by #39872
Open
Assignees
Labels
Area: Content Component: Image Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for dev Reported on 2.4.7 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@kapilpandya2203
Copy link

kapilpandya2203 commented Sep 6, 2024

Preconditions (*)

  1. Magento 2.4.6-p4
  2. Magento 2.4.7
  3. Magento Developer branch
  4. Indexer mode: Update by schedule

Description (*)

When we upload an image to the product and without saving the product again we delete the image and then we save the product, the image is added for resize in queue. And the error of system message is shown with failure of queue message.

Screenshot 1:
s1

Screenshot 2:
s6

Screenshot 3:
s5

Steps to reproduce (*)

  1. Access magento admin panel and set the indexer mode to Update by Schedule
  2. Go to Catalog->Product.
  3. Create a product or edit any existing product and upload a image and again remove the uploaded image without saving the product.
  4. Then save the product.
  5. Run media.storage.catalog.image.resize consumer

Expected result (*)

As the image was not saved to the product, hence the image should not be added to the queue for image resize.

Actual result (*)

As the image was not saved to the product, but the image is getting added to the queue for image resize.

Additional information (*)

When we upload the image, a copy of the image is created in tmp folder. And when we remove the image without saving the product the image in the tmp folder is not removed and hence the path of the image is sent to the Image resize queue due to which the consumer is not able to locate the .tmp image file in pub/media/catalog/product path as the .tmp image never existed in the given path.
Hence, it results into the failure of queue and it throws a system message.

Files:

  1. magento/module-catalog/Controller/Adminhtml/Product/Gallery/Upload.php
  2. magento/module-catalog/Observer/ImageResizeAfterProductSave.php
  3. magento/module-media-storage/Service/ImageResize.php

Upload controller is called when we upload a image and it sets the response and send it to the ImageResizeAfterProductSave observer in which the image file name is sent to the queue using ImageResize.
Even if we remove the product image right after uploading it and without saving the product, Upload controller still send the image path with .tmp extension to the observer and from there it goes to queue which fails afterwards.

Screenshot 4:
s4

Copy link

m2-assistant bot commented Sep 6, 2024

Hi @kapilpandya2203. 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.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 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.

Copy link

m2-assistant bot commented Sep 6, 2024

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: 👇

  • 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.

@engcom-Bravo engcom-Bravo added the Reported on 2.4.7 Indicates original Magento version for the Issue report. label Sep 6, 2024
@engcom-Bravo
Copy link
Contributor

@magento give me 2.4-develop instance

Copy link

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

Copy link

@engcom-Bravo
Copy link
Contributor

Hi @kapilpandya2203,

Thanks for your reporting and collaboration.

We have verified the issue in Latest 2.4-develop instance and the issue is reproducible.Kindly refer the screenshots.

Steps to reproduce

  • Access magento admin panel and set the indexer mode to Update by Schedule
  • Go to Catalog->Product.
  • Create a product or edit any existing product and upload a image and again remove the uploaded image without saving the product.
  • Then save the product.
  • Run media.storage.catalog.image.resize consumer
Screenshot 2024-09-10 at 11 06 11

As the image was not saved to the product, but the image is getting added to the queue for image resize.

Hence Confirming the issue.

Thanks.

@engcom-Bravo engcom-Bravo added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Component: Image Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Area: Content labels Sep 10, 2024
@github-jira-sync-bot
Copy link

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

Copy link

m2-assistant bot commented Sep 10, 2024

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

@KrasnoshchokBohdan
Copy link
Contributor

@magento I am working on this

KrasnoshchokBohdan added a commit to KrasnoshchokBohdan/magento2 that referenced this issue Apr 29, 2025
…n deleting unsaved product images

- clean up removed images from the image array
KrasnoshchokBohdan added a commit to KrasnoshchokBohdan/magento2 that referenced this issue May 2, 2025
…n deleting unsaved product images

- static tests fix
KrasnoshchokBohdan added a commit to KrasnoshchokBohdan/magento2 that referenced this issue May 2, 2025
…n deleting unsaved product images

- copyright
KrasnoshchokBohdan added a commit to KrasnoshchokBohdan/magento2 that referenced this issue May 3, 2025
…n deleting unsaved product images

- fix for static tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Content Component: Image Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for dev Reported on 2.4.7 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
None yet
4 participants