Skip to content
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

Product stock status change does not purge product varnish cache #39056

Open
5 tasks
zakdma opened this issue Aug 16, 2024 · 7 comments · May be fixed by #39118
Open
5 tasks

Product stock status change does not purge product varnish cache #39056

zakdma opened this issue Aug 16, 2024 · 7 comments · May be fixed by #39118
Assignees
Labels
Area: Product Component: Stock Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: dev in progress Reported on 2.4.7-p2 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

@zakdma
Copy link
Contributor

zakdma commented Aug 16, 2024

Preconditions and environment

  • Magento version is the latest 2.4.7-p2
  • Varnish is used as FPC
  • Indexers are in UPDATE BY SCHEDULE mode
  • Cron is running

Steps to reproduce

  1. Logon into admin panel
  2. Go to Stores>Configuration>Catalog>Inventory. Open the Stock Options dropdown. Set Yes in the Display Out of Stock Products option
  3. Create a simple product with a stock quantity (id = 1, SKU = simple1)
  4. Please note: Varnish cache should be enabled
  5. Go to System > Extensions > Integrations
  6. Add new integration.
  7. Below the General section enter Name, Email (optional), and Password.
  8. In the left menu, click API.
  9. From the Resource Access drop-down menu, select All.
  10. Click Save
  11. On the Integrations page, next to the newly created integration, click Activate.
  12. On the Integration page, you can find the list of the resources, click Allow.
  13. The Integration Token Details are generated.
  14. Copy and save Access Token to use it further
  15. Click Done.
  16. Go to Stores > Configuration > Services > OAuth > Consumer Settings > Allow OAuth Access Tokens to be used as standalone Bearer tokens option to Yes. Save configuration.
  17. Open the product on the front and see it's in stock
  18. Use any REST client and run the request
curl -X PUT "https://<magento-host>/rest/V1/products/simple1/stockItems/1" -H "Authorization: Bearer <access-token>" -H "Content-Type:application/json" --globoff -k --data-binary @- << EOF
{
  "stock_item": {
    "qty": 55.0,
    "is_in_stock": false
  }
}
EOF
  1. Refresh the front product page.

Expected result

Product became "Out of Stock" on the front page

Actual result

Product is still "In Stock" on the front page

Additional information

The problem is that Stock indexer does not reset FPC for product (tag: cat_p_) when reindexed
See stock indexer implementation
https://github.com/magento/magento2/blame/2.4-develop/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php#L84
and compare it with the Price indexer
https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Catalog/Model/Indexer/Product/Price.php#L96

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.
  • 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”.
Copy link

m2-assistant bot commented Aug 16, 2024

Hi @zakdma. 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.

@andrewbess
Copy link

Hello @zakdma
Thank you for your contribution
Great catch
Could you please provide the fix
Thank you in advance.

@engcom-Hotel engcom-Hotel moved this to Ready for Confirmation in Issue Confirmation and Triage Board Aug 19, 2024
@engcom-Bravo engcom-Bravo added the Reported on 2.4.7-p2 Indicates original Magento version for the Issue report. label Aug 26, 2024
@engcom-Delta engcom-Delta self-assigned this Aug 30, 2024
Copy link

m2-assistant bot commented Aug 30, 2024

Hi @engcom-Delta. 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-Delta
Copy link
Contributor

Hi @zakdma ,

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
1.Go to Stores>Configuration>Catalog>Inventory. Open the Stock Options dropdown. Set Yes in the Display Out of Stock Products option
image
2. Enable Varnish Cache
image
3. Create a simple product with a stock quantity (id = 1, SKU = simple1)
image
4. Go to System > Extensions > Integrations
5. Add new integration.
6. Below the General section enter Name, Email (optional), and Password.
7. In the left menu, click API.
8. From the Resource Access drop-down menu, select All.
9. Click Save
10. On the Integrations page, next to the newly created integration, click Activate.
11. On the Integration page, you can find the list of the resources, click Allow.
12. The Integration Token Details are generated.
13. Copy and save Access Token to use it further
14. Click Done.
15.Go to Stores > Configuration > Services > OAuth > Consumer Settings > Allow OAuth Access Tokens to be used as standalone Bearer tokens option to Yes. Save configuration.
16.Open the product on the front and see it's in stock
image
17. Use any REST client and run the request
image
18. Refresh the front product page. Observe product is still in stock.
image

Thanks.

@engcom-Delta engcom-Delta added Reported on 2.4.x Indicates original Magento version for the Issue report. Area: Catalog Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Aug 30, 2024
@github-jira-sync-bot github-jira-sync-bot removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Aug 30, 2024
@github-jira-sync-bot
Copy link

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

@engcom-Bravo engcom-Bravo added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Product Component: Stock and removed Reported on 2.4.x Indicates original Magento version for the Issue report. Area: Catalog labels Sep 2, 2024
@github-jira-sync-bot
Copy link

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

Copy link

m2-assistant bot commented Sep 2, 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.

@engcom-Bravo engcom-Bravo moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board Sep 2, 2024
@engcom-Delta engcom-Delta added the Priority: P3 May be fixed according to the position in the backlog. label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Product Component: Stock Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: dev in progress Reported on 2.4.7-p2 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
Development

Successfully merging a pull request may close this issue.

5 participants