Skip to content

[Issue] Fix order spam when search engine is down #36349

@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #36241: Fix order spam when search engine is down


Description (*)

Orders can be spammed if the search engine service is down and the Catalog Search index mode is set to Update on Save.
This is caused by an unhandled exception on the "Magento\CatalogInventory\Observer\ReindexQuoteInventoryObserver" observer for the "sales_model_service_quote_submit_success"event. The exception is caused because both price and stock catalog re-indexation trigger a fulltext re-index. The solution I found was to handle the exception during the observer execution and invalidate the offending indexes for later re-indexation.

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes Magento 2.4.x When Elasticsearch doesn't work, orderings will be unlimitedly spammed.  #36119

Manual testing scenarios (*)

  1. Add to cart
  2. Go checkout page
  3. Disable Elasticsearch service (Elasticsearch suddenly stop working)
  4. Click Place Order button

Expected result
The order is placed without any issues and both Produce Price and Stock Indexes should be invalidated (reindex required in the admin dashboard).
image
image

Questions or comments

One of the items listed in the expected scenario proposed in the issue ("Admin should not be able to do invoice,shipping etc.") should not be considered since the order can be placed correctly when the search engine is not working and the issue with the order spamming can be resolved by correctly handling the exception thrown after the order is already placed.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

Labels

Priority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: done

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions