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

Queue Management Issue (DB MQ) #37559

Closed
5 tasks
makkoff opened this issue May 30, 2023 · 5 comments
Closed
5 tasks

Queue Management Issue (DB MQ) #37559

makkoff opened this issue May 30, 2023 · 5 comments
Assignees
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.6 Indicates original Magento version for the Issue report.

Comments

@makkoff
Copy link

makkoff commented May 30, 2023

Preconditions and environment

  • Magento Cloud 2.4.6
  • Configured slave connection with DB (default at Magento Cloud version)

Steps to reproduce

Note: Can reproduce this issue only at magneto cloud staging environment since there we use slave connection to the DB.

  1. Proceed to checkout
  2. Click on "Place Order" button

Expected result

The order was placed and the inventory.reservations.updateSalabilityStatus queue was successfully added

Actual result

Getting the error:
image

the inventory.reservations.updateSalabilityStatus queue fails because the \Magento\MysqlMq\Model\ResourceModel\Queue::saveMessage returns 0 instead of the last insert id(message id).

I added a rewrite for Magento\ResourceConnections\DB\Adapter\Pdo\MysqlProxy to log the last insert IDs of slave and master connections:

image

And here is the result:
[2023-05-30T12:47:36.737265+00:00] db_queue_logger.DEBUG: CONNECTIONS LOG: [] [] [2023-05-30T12:47:36.737307+00:00] db_queue_logger.DEBUG: MASTER Connection last insert ID - 9312 [] [] [2023-05-30T12:47:36.737347+00:00] db_queue_logger.DEBUG: MASTER Connection last insert ID with "queue" table - 9312 [] [] [2023-05-30T12:47:36.737387+00:00] db_queue_logger.DEBUG: SLAVE Connection last insert ID - 0 [] [] [2023-05-30T12:47:36.737425+00:00] db_queue_logger.DEBUG: SLAVE Connection last insert ID with "queue" table - 0

Additional information

DB query log:
...

     2023-05-25 15:04:45
       QUERY
         SQL: INSERT  INTO `queue_message_status` (`queue_id`,`message_id`,`status`) VALUES (?, ?, ?)
   BIND: array (
 0 => '44',
 1 => '0',
 2 => 2,
) 
  TIME: 0.0011
TRACE: #1 Magento\Framework\DB\Logger\File[Magento\Framework\DB\Logger\LoggerAbstract]#00000000000001300000000000000000#->getStats('query', 'INSERT  INTO `qu...', array(44, 0, 2), NULL) called at [vendor/magento/framework/DB/Logger/File.php:67]
#2 Magento\Framework\DB\Logger\File#00000000000001300000000000000000#->logStats('query', 'INSERT  INTO `qu...', array(44, 0, 2), NULL) called at [vendor/magento/framework/DB/Logger/LoggerProxy.php:152]
#3 Magento\Framework\DB\Logger\LoggerProxy#000000000000010c0000000000000000#->logStats('query', 'INSERT  INTO `qu...', array(44, 0, 2)) called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:597]
#4 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor[Magento\Framework\DB\Adapter\Pdo\Mysql]#00000000000010830000000000000000#->_query('INSERT  INTO `qu...', array(44, 0, 2)) called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:634]
#5 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor[Magento\Framework\DB\Adapter\Pdo\Mysql]#00000000000010830000000000000000#->query('INSERT  INTO `qu...', array(44, 0, 2)) called at [vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:2125]
#6 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor[Magento\Framework\DB\Adapter\Pdo\Mysql]#00000000000010830000000000000000#->insertArray('queue_message_st...', array('queue_id', 'message_id', 'status'), array(array(44, 0, 2)), 0) called at [vendor/magento/module-resource-connections/DB/Adapter/Pdo/MysqlProxy.php:609]
#7 Magento\ResourceConnections\DB\Adapter\Pdo\MysqlProxy\Interceptor[Magento\ResourceConnections\DB\Adapter\Pdo\MysqlProxy]#000000000000010f0000000000000000#->insertArray('queue_message_st...', array('queue_id', 'message_id', 'status'), array(array(44, 0, 2))) called at [vendor/magento/module-mysql-mq/Model/ResourceModel/Queue.php:98]
#8 Magento\MysqlMq\Model\ResourceModel\Queue#000000000000140f0000000000000000#->linkMessagesWithQueues(array(0), array('inventory.reserv...')) called at [vendor/magento/module-mysql-mq/Model/ResourceModel/Queue.php:72]
#9 Magento\MysqlMq\Model\ResourceModel\Queue#000000000000140f0000000000000000#->linkQueues(0, array('inventory.reserv...')) called at [vendor/magento/module-mysql-mq/Model/QueueManagement.php:89]
#10 Magento\MysqlMq\Model\QueueManagement#00000000000014110000000000000000#->addMessageToQueues('inventory.reserv...', '{"skus":["Macboo...', array('inventory.reserv...')) called at [vendor/magento/module-mysql-mq/Model/Driver/Exchange.php:73]
#11 Magento\MysqlMq\Model\Driver\Exchange#00000000000014120000000000000000#->enqueue('inventory.reserv...', &Magento\Framework\MessageQueue\Envelope#00000000000013e90000000000000000#) called at [vendor/magento/framework-message-queue/Publisher.php:95]
#12 Magento\Framework\MessageQueue\Publisher#0000000000000fb50000000000000000#->publish('inventory.reserv...', '{"skus":["Macboo...') called at [vendor/magento/framework-message-queue/PublisherPool.php:89]
#13 Magento\Framework\MessageQueue\PublisherPool#0000000000000fb40000000000000000#->publish('inventory.reserv...', &Magento\InventoryIndexer\Model\Queue\ReservationData#00000000000013e30000000000000000#) called at [vendor/magento/module-inventory-indexer/Plugin/InventorySales/EnqueueAfterPlaceReservationsForSalesEvent.php:77]
#14 

...

   2023-05-25 15:04:45
    EXCEPTION
    PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`{magento cloud project id}`.`queue_message_status`, CONSTRAINT `QUEUE_MESSAGE_STATUS_MESSAGE_ID_QUEUE_MESSAGE_ID` FOREIGN KEY (`message_id`) REFERENCES `queue_message` (`id`) ON DELETE CASCADE) in /app/{magento cloud project id}/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:90
    Stack trace:
    #0 /app/{magento cloud project id}/vendor/magento/framework/DB/Statement/Pdo/Mysql.php(90): PDOStatement->execute(Array)
    #1 /app/{magento cloud project id}/vendor/magento/framework/DB/Statement/Pdo/Mysql.php(106): Magento\Framework\DB\Statement\Pdo\Mysql->Magento\Framework\DB\Statement\Pdo\{closure}()
    #2 /app/{magento cloud project id}/vendor/magento/framework/DB/Statement/Pdo/Mysql.php(91): Magento\Framework\DB\Statement\Pdo\Mysql->tryExecute(Object(Closure))
    #3 /app/{magento cloud project id}/vendor/magento/zend-db/library/Zend/Db/Statement.php(313): Magento\Framework\DB\Statement\Pdo\Mysql->_execute(Array)
    #4 /app/{magento cloud project id}/vendor/magento/zend-db/library/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
    #5 /app/{magento cloud project id}/vendor/magento/zend-db/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT  INTO `q...', Array)
    #6 /app/{magento cloud project id}/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(564): Zend_Db_Adapter_Pdo_Abstract->query('INSERT  INTO `q...', Array)
    #7 /app/{magento cloud project id}/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(634): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('INSERT  INTO `q...', Array)
    #8 /app/{magento cloud project id}/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(2125): Magento\Framework\DB\Adapter\Pdo\Mysql->query('INSERT  INTO `q...', Array)
    #9 /app/{magento cloud project id}/vendor/magento/module-resource-connections/DB/Adapter/Pdo/MysqlProxy.php(609): Magento\Framework\DB\Adapter\Pdo\Mysql->insertArray('queue_message_s...', Array, Array, 0)
    #10 /app/{magento cloud project id}/vendor/magento/module-mysql-mq/Model/ResourceModel/Queue.php(98): Magento\ResourceConnections\DB\Adapter\Pdo\MysqlProxy->insertArray('queue_message_s...', Array, Array)
    #11 /app/{magento cloud project id}/vendor/magento/module-mysql-mq/Model/ResourceModel/Queue.php(72): Magento\MysqlMq\Model\ResourceModel\Queue->linkMessagesWithQueues(Array, Array)
    #12 /app/{magento cloud project id}/vendor/magento/module-mysql-mq/Model/QueueManagement.php(89): Magento\MysqlMq\Model\ResourceModel\Queue->linkQueues('0', Array)
    #13 /app/{magento cloud project id}/vendor/magento/module-mysql-mq/Model/Driver/Exchange.php(73): Magento\MysqlMq\Model\QueueManagement->addMessageToQueues('inventory.reser...', '{"skus":["Macbo...', Array)
    #14 /app/{magento cloud project id}/vendor/magento/framework-message-queue/Publisher.php(95): Magento\MysqlMq\Model\Driver\Exchange->enqueue('inventory.reser...', Object(Magento\Framework\MessageQueue\Envelope))
    #15 /app/{magento cloud project id}/vendor/magento/framework-message-queue/PublisherPool.php(89): Magento\Framework\MessageQueue\Publisher->publish('inventory.reser...', '{"skus":["Macbo...')
    #16 /app/{magento cloud project id}/vendor/magento/module-inventory-indexer/Plugin/InventorySales/EnqueueAfterPlaceReservationsForSalesEvent.php(77): Magento\Framework\MessageQueue\PublisherPool->publish('invent`

Release note

This part of code was changed in 2.4.6
\Magento\ResourceConnections\DB\Adapter\Pdo\MysqlProxy::selectConnection

image

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”.
@m2-assistant
Copy link

m2-assistant bot commented May 30, 2023

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

@engcom-Bravo engcom-Bravo added the Reported on 2.4.6 Indicates original Magento version for the Issue report. label May 30, 2023
@engcom-Bravo engcom-Bravo self-assigned this Jun 1, 2023
@m2-assistant
Copy link

m2-assistant bot commented Jun 1, 2023

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
Copy link
Contributor

Hi @makkoff,

Thank you for reporting and collaboration.

Verified the issue on Magento 2.4.6 cloud instance and the issue is not reproducible.Kindly refer the attached video.

Steps to reproduce

  • Proceed to checkout
  • Click on "Place Order" button

We are able to place the order successfully.

Untitled.23.mp4

Kindly recheck the behaviour on Magento 2.4.6 cloud instance and elaborate steps to reproduce if the issue is still reproducible.

Thanks.

@engcom-Bravo engcom-Bravo added the Issue: needs update Additional information is require, waiting for response label Jun 12, 2023
@engcom-Bravo
Copy link
Contributor

Hi @makkoff,

Kindly provide us latest update on this #37559 (comment) you are able to reproduce the issue or still working on this issue and also please let us know if we are missing anything.

Thanks.

@engcom-Bravo
Copy link
Contributor

Hi @makkoff,

We have noticed that this issue has not been updated since long time.
Hence we assume that this issue is fixed now, so we are closing it. Please feel to raise a fresh ticket or reopen this ticket if you need more assistance on this.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: needs update Additional information is require, waiting for response Reported on 2.4.6 Indicates original Magento version for the Issue report.
Projects
None yet
Development

No branches or pull requests

2 participants