Skip to content

Messenger PostgreSQL use_notify not working with Doctrine DBAL 3 #43601

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
99hops opened this issue Oct 20, 2021 · 7 comments
Closed

Messenger PostgreSQL use_notify not working with Doctrine DBAL 3 #43601

99hops opened this issue Oct 20, 2021 · 7 comments

Comments

@99hops
Copy link

99hops commented Oct 20, 2021

Symfony version(s) affected: 5.3.9

Description
After update to Doctrine 2.10.1 which is "current" consumers using PostgreSQL are failing

How to reproduce
Discussed here

Possible Solution
The driver connection does not extend the PDO connection anymore. There's a getWrappedConnection() method in case you need to access it.

@derrabus
Copy link
Member

Just to recap: You did upgrade to doctrine/dbal 3.1 and then the problem appeared? Have you tried downgrading DBAL to 2.13? Can you provide a stack trace of the issue?

@99hops
Copy link
Author

99hops commented Oct 20, 2021

I did upgrade doctrine/orm 2.9.0 => 2.10.1 which upgraded doctrine/dbal 2.13.4 => 3.1.3 as dependency.
Locking doctrine/orm to 2.9 ("doctrine/orm": "2.9") downgrades doctrine/dbal 3.1.3 => 2.13.4 which solves the issue.

My point is that we need to support the current version of doctrine/orm (2.10.1) as 2.9 is now unmaintained.

@derrabus
Copy link
Member

derrabus commented Oct 20, 2021

You know that you can use ORM 2.10 with DBAL 2.13, right?

Anyway, I don't want to suggest downgrades as a solution. I want to trace down your problem. So if you could answer my questions, that would very much help me help you.

@derrabus derrabus changed the title Messenger PostgreSQL use_notify not working with Doctrine 2.10.1 Messenger PostgreSQL use_notify not working with Doctrine DBAL 3 Oct 20, 2021
@derrabus
Copy link
Member

Can you please test if #43630 fixes the problem for you?

@99hops
Copy link
Author

99hops commented Oct 21, 2021

Here is the trace with DBAL 2.13.4

In PostgreSqlConnection.php line 75:

  [Symfony\Component\ErrorHandler\Error\UndefinedMethodError]
  Attempted to call an undefined method named "pgsqlGetNotify" of class "Doctrine\DBAL\Driver\PDO\Connection".


Exception trace:
  at /var/www/html/vendor/symfony/doctrine-messenger/Transport/PostgreSqlConnection.php:75
 Symfony\Component\Messenger\Bridge\Doctrine\Transport\PostgreSqlConnection->get() at /var/www/html/vendor/symfony/doctrine-messenger/Transport/DoctrineReceiver.php:50
 Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineReceiver->get() at /var/www/html/vendor/symfony/doctrine-messenger/Transport/DoctrineTransport.php:45
 Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineTransport->get() at /var/www/html/vendor/symfony/messenger/Worker.php:88
 Symfony\Component\Messenger\Worker->run() at /var/www/html/vendor/symfony/messenger/Command/ConsumeMessagesCommand.php:209
 Symfony\Component\Messenger\Command\ConsumeMessagesCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:299
 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:996
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:96
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:295
 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:82
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:167
 Symfony\Component\Console\Application->run() at /var/www/html/bin/console:43

While the proposed fix doesn't throw error with DBAL 3.1.3 it does throw another error when downgraded to 2.13.4

In PostgreSqlConnection.php line 78:

  [Symfony\Component\ErrorHandler\Error\UndefinedMethodError]
  Attempted to call an undefined method named "getWrappedConnection" of class "Doctrine\DBAL\Driver\PDO\Connection".


Exception trace:
  at /var/www/html/vendor/symfony/doctrine-messenger/Transport/PostgreSqlConnection.php:78
 Symfony\Component\Messenger\Bridge\Doctrine\Transport\PostgreSqlConnection->get() at /var/www/html/vendor/symfony/doctrine-messenger/Transport/DoctrineReceiver.php:50
 Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineReceiver->get() at /var/www/html/vendor/symfony/doctrine-messenger/Transport/DoctrineTransport.php:45
 Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineTransport->get() at /var/www/html/vendor/symfony/messenger/Worker.php:88
 Symfony\Component\Messenger\Worker->run() at /var/www/html/vendor/symfony/messenger/Command/ConsumeMessagesCommand.php:209
 Symfony\Component\Messenger\Command\ConsumeMessagesCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:299
 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:996
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:96
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:295
 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:82
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:167
 Symfony\Component\Console\Application->run() at /var/www/html/bin/console:43

@derrabus
Copy link
Member

I've pushed another fix to that PR, can you please check again?

Apparently we're lacking a real integration test that covers the Postgres-specific logic for the messenger. I'll create an issue for that.

@tmurtazin
Copy link

tmurtazin commented Oct 21, 2021

I checked current #43630 , that solves the same problem for me (DBAL 3.1.3)

@fabpot fabpot closed this as completed Oct 21, 2021
fabpot added a commit that referenced this issue Oct 21, 2021
… 3 (derrabus)

This PR was merged into the 5.3 branch.

Discussion
----------

[Messenger] Fix unwrapping the Postgres connection in DBAL 3

| Q             | A
| ------------- | ---
| Branch?       | 5.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #43601
| License       | MIT
| Doc PR        | N/A

Commits
-------

95d5790 [Messenger] Fix unwrapping the Postgres connection in DBAL 3
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