Description
Preconditions and environment
- Magento version: 2.4.5-p1
- Anything else that would help a developer reproduce the bug
Steps to reproduce
- Schedule many operations under same bulk with
BulkManagementInterface::scheduleBulk
- Before all operations finish the execution get the status of the bulk with
BulkStatusInterface::getBulkStatus
Expected result
Bulk status is NOT_STARTED (0) when all operations are OPEN (4)
Bulk status is IN_PROGRESS (1) when at least one operation is OPEN(4)
In other words, bulk status is only in FINISHED_* (2,3) state when all operations are not OPEN(4)
Actual result
Bulk status is FINISHED_WITH_FAILURE (3) when some operations are COMPLETE(1) and OPEN(4).
It returns FINISHED_SUCCESSFULLY (2) once all operations are COMPLETE (1).
Additional information
Logic is implemented in this function:
magento2/app/code/Magento/AsynchronousOperations/Model/BulkStatus.php
Lines 140 to 181 in 7c6b636
I created a dedicated magento module to reproduce the issue (see README file for details):
magento2-gh-36911-main.zip
The execution of the command provided in the module outputs the following log which confirms the issue:
[2023-02-23T12:03:32.740515+00:00] main.INFO: Bulk id created {"issue":"gh-36911","bulkId":"2e04e5a5-cfea-434b-95cc-33bb48eea1f3"} []
[2023-02-23T12:03:32.763650+00:00] main.INFO: Scheduled operation 1 {"issue":"gh-36911","bulkId":"2e04e5a5-cfea-434b-95cc-33bb48eea1f3"} []
[2023-02-23T12:03:32.771172+00:00] main.INFO: Scheduled operation 2 {"issue":"gh-36911","bulkId":"2e04e5a5-cfea-434b-95cc-33bb48eea1f3"} []
[2023-02-23T12:03:32.777690+00:00] main.INFO: Scheduled operation 3 {"issue":"gh-36911","bulkId":"2e04e5a5-cfea-434b-95cc-33bb48eea1f3"} []
[2023-02-23T12:03:32.779483+00:00] main.INFO: Bulk status before executing all operations is 3 {"issue":"gh-36911","bulkId":"2e04e5a5-cfea-434b-95cc-33bb48eea1f3"} []
[2023-02-23T12:03:32.793993+00:00] main.INFO: Bulk status before consuming operation 1 is 3 {"issue":"gh-36911","bulkId":"2e04e5a5-cfea-434b-95cc-33bb48eea1f3"} []
[2023-02-23T12:03:32.795633+00:00] main.INFO: Bulk status after consuming operation 1 is 3 {"issue":"gh-36911","bulkId":"2e04e5a5-cfea-434b-95cc-33bb48eea1f3"} []
[2023-02-23T12:03:32.800481+00:00] main.INFO: Bulk status before consuming operation 2 is 3 {"issue":"gh-36911","bulkId":"2e04e5a5-cfea-434b-95cc-33bb48eea1f3"} []
[2023-02-23T12:03:32.801980+00:00] main.INFO: Bulk status after consuming operation 2 is 3 {"issue":"gh-36911","bulkId":"2e04e5a5-cfea-434b-95cc-33bb48eea1f3"} []
[2023-02-23T12:03:32.806389+00:00] main.INFO: Bulk status before consuming operation 3 is 3 {"issue":"gh-36911","bulkId":"2e04e5a5-cfea-434b-95cc-33bb48eea1f3"} []
[2023-02-23T12:03:32.807890+00:00] main.INFO: Bulk status after consuming operation 3 is 3 {"issue":"gh-36911","bulkId":"2e04e5a5-cfea-434b-95cc-33bb48eea1f3"} []
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”.