Open
Description
Preconditions and environment
- Magento version 2.4.6-p2
Steps to reproduce
- Create a command
test:publish_message
that publish a message on a queue - Create a consumer that loads and display a product stock qty (via stock registry), and logs it. (initial qty = 100)
- Launch the consumer
- Run the test:publish_message
- Edit the qty of the product on backend (qty : 200)
- Run the test:publish_message
- Check consumer's logs
Expected result
Logs should display :
100
200
Actual result
Logs display :
100
100
Additional information
This is because both messages are running in the same environement, without any reset of any kind.
With a high value of --max-messages
or with consumers-wait-for-messages
a consumer can run for days before restarting. This can have very bad consequences for some consumers.
I guess the easiest and safest solution is to run the message execution in a new process. But maybe it could also do the trick to - somehow - reset ObjectManager between each messages (But I'm afraid about memory consumption with that).
Workaround :
(with --consumers-wait-for-messages=1
)
while true; do bin/magento queue:consumers:start --max-messages=1 -vvv consumer.name; done
This is a lot slower :/ but it solves the issue while waiting for a fix.
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”.
Metadata
Metadata
Assignees
Labels
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmedA defect with this priority could have functionality issues which are not to expectations.Indicates original Magento version for the Issue report.The issue has been reproduced on latest 2.4-develop branchIssue related to Developer Experience and needs help with Triage to Confirm or Reject it