Skip to content

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

Open
@kapilpandya2203

Description

@kapilpandya2203

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

Activity

m2-assistant

m2-assistant commented on Sep 6, 2024

@m2-assistant

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.

self-assigned this
on Sep 6, 2024
m2-assistant

m2-assistant commented on Sep 6, 2024

@m2-assistant

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 commented on Sep 10, 2024

@engcom-Bravo
Contributor

@magento give me 2.4-develop instance

magento-deployment-service

magento-deployment-service commented on Sep 10, 2024

@magento-deployment-service

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

engcom-Bravo

engcom-Bravo commented on Sep 10, 2024

@engcom-Bravo
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.

added
Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmed
Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch
Priority: P2A defect with this priority could have functionality issues which are not to expectations.
on Sep 10, 2024

4 remaining items

m2-assistant

m2-assistant commented on Sep 10, 2024

@m2-assistant

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

moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Boardon Sep 10, 2024
KrasnoshchokBohdan

KrasnoshchokBohdan commented on Apr 28, 2025

@KrasnoshchokBohdan
Contributor

@magento I am working on this

added a commit that references this issue on Apr 29, 2025

magento#39146: Image resize queue error due to .tmp file handling whe…

added 3 commits that reference this issue on May 2, 2025

magento#39146: Image resize queue error due to .tmp file handling whe…

magento#39146: Image resize queue error due to .tmp file handling whe…

magento#39146: Image resize queue error due to .tmp file handling whe…

added a commit that references this issue on May 12, 2025

magento#39146: Image resize queue error due to .tmp file handling whe…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area: ContentComponent: ImageIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.7Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @engcom-Bravo@github-jira-sync-bot@KrasnoshchokBohdan@kapilpandya2203

    Issue actions

      Image resize queue error due to .tmp file handling when deleting unsaved product images · Issue #39146 · magento/magento2