8000 warning message on failed messenger show command · Issue #49262 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

warning message on failed messenger show command #49262

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

Closed
gstapinato opened this issue Feb 6, 2023 · 3 comments
Closed

warning message on failed messenger show command #49262

gstapinato opened this issue Feb 6, 2023 · 3 comments

Comments

@gstapinato
Copy link
Contributor

Symfony version(s) affected

5.4 - 6.3

Description

Show warning message 'Undefined array key "headers"' when I'm trying to execute a command to show messages from the failure transport.
This error only can be reproduced from Doctrine transport using oracle database.

The reason for this exception is because most Oracle databases use UPPER CASE on tables and column identifiers.

How to reproduce

Small example application that allows to reproduce this issue: https://github.com/gstapinato/symfony_messenger_oracle

Command: bin/console messenger:failed:show

$ bin/console messenger:failed:show
There are xx messages pending in the failure transport.

Exception message:  Undefined array key \"headers\" 

/srv/app/vendor/symfony/doctrine-messenger/Transport/Connection.php:458
/srv/app/vendor/symfony/doctrine-messenger/Transport/Connection.php:309
/srv/app/vendor/symfony/doctrine-messenger/Transport/Connection.php:308
/srv/app/vendor/symfony/doctrine-messenger/Transport/DoctrineReceiver.php:113
/srv/app/vendor/symfony/messenger/Command/FailedMessagesShowCommand.php:98
/srv/app/vendor/symfony/messenger/Command/FailedMessagesShowCommand.php:83
/srv/app/vendor/symfony/console/Command/Command.php:298
/srv/app/vendor/symfony/console/Command/LazyCommand.php:71
/srv/app/vendor/symfony/console/Tester/CommandTester.php:74
/srv/app/tests/FailureIntegrationTest.php:41
/srv/app/tests/FailureIntegrationTest.php:24

Possible Solution

On File: "Symfony\Component\Messenger\Bridge\Doctrine\Tests\Transport\Connection.php"

Additional Context

Related to: #44988

@alamirault
Copy link
Contributor
alamirault commented Feb 7, 2023

Thanks for your great reproducer.

In get method is ok

$doctrineEnvelope = $stmt instanceof Result || $stmt instanceof DriverResult ? $stmt->fetchAssociative() : $stmt->fetch();

^ array:7 [
  "id" => "24"
  "body" => "O:36:\"Symfony\\Component\\Messenger\\Envelope\":2:{s:44:\"\0Symfony\\Component\\Messenger\\Envelope\0stamps\";a:1:{s:46:\"Symfony\\Component\\Messenger\\Stamp\\BusNameStamp\";a:1:{i:0;O:46:\"Symfony\\Component\\Messenger\\Stamp\\BusNameStamp\":1:{s:55:\"\0Symfony\\Component\\Messenger\\Stamp\\BusNameStamp\0busName\";s:21:\"messenger.bus.default\";}}}s:45:\"\0Symfony\\Component\\Messenger\\Envelope\0message\";O:22:\"App\\Message\\AppMessage\":0:{}}"
  "headers" => []
  "queue_name" => "async"
  "created_at" => "2023-02-07 20:09:03"
  "available_at" => "2023-02-07 20:09:03"
  "delivered_at" => null
]

However in findAll, keys are uppercases

$data = $stmt instanceof Result || $stmt instanceof DriverResult ? $stmt->fetchAllAssociative() : $stmt->fetchAll();

^ array:1 [
  0 => array:7 [
    "ID" => "25"
    "BODY" => """
      REMOVED
      """
    "HEADERS" => "[]"
    "QUEUE_NAME" => "failed"
    "CREATED_AT" => "2023-02-07 20:09:03"
    "AVAILABLE_AT" => "2023-02-07 20:09:03"
    "DELIVERED_AT" => null
  ]
]

I don't know how to fix it, but community will know

@gstapinato
Copy link
Contributor Author

I'm going to create a PR to fix this bug

@gstapinato
Copy link
Contributor Author

Thanks @alamirault for adding this relevant information.
I've created a PR based on this issue.

nicolas-grekas added a commit that referenced this issue Apr 18, 2023
…ommand (gstapinato)

This PR was merged into the 5.4 branch.

Discussion
----------

[Messenger] Fix warning message on failed messenger show command

Can only be reproduced on Oracle Databases.

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #49262
| License       | MIT

Fix warning message on failed messenger show command

Commits
-------

4ad8101 [Messenger] Fix warning message on failed messenger show command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
0