Skip to content

[Messenger][DoctrineBridge] Throws UnrecoverableMessageHandlingException when passed invalid entity manager name #31482

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

Merged
merged 1 commit into from
May 21, 2019

Conversation

Koc
Copy link
Contributor

@Koc Koc commented May 12, 2019

Q A
Branch? 4.3
Bug fix? yes
New feature? no
BC breaks? not sure
Deprecations? no
Tests pass? Waiting for Travis
Fixed tickets -
License MIT
Doc PR -
  1. Throws UnrecoverableMessageHandlingException and do not retry messages if middlewares missconfigured
  2. getManager() doesn't return null. Actually it throws \InvalidArgumentException in requested entity manager not exists.

Not sure, should this changes considered as BC-break.

Also I can extract abstract Doctrine middleware but not sure what branch should I use for it? Master or 4.3?

@Koc Koc requested a review from sroze as a code owner May 12, 2019 12:18
@sroze
Copy link
Contributor

sroze commented May 12, 2019

Well.. it is actually recoverable because if this happens: 1) you see the errors somewhere (Sentry, Bugsnag, etc...), 2) you will fix it and 3) you will redeploy. At no point in this you expect the infrastructure to destroy these messages (which is what it means to have an unrecoverable error).

@Koc
Copy link
Contributor Author

Koc commented May 12, 2019

I've opened this PR because @Tobion suggested make this change in related PR #31334 (comment) .

Not sure that developer will have enough time to fix problem and redeploy before messages goes to failed transport after N retries. And there is possibility to retry message from failed transport since Symfony 4.3.

But in any case getManager() doesn't return null and check should be reworked.

@Tobion
Copy link
Contributor

Tobion commented May 13, 2019

Recoverable to me means that it is a temporary problem that might fix itself by just retrying. If it's a coding problem auto-retrying does not make sense. If you argue it's recoverable because you can fix it manually, then where is the difference between recoverable and unrecoverable? Everything is recoverable then if you change code...

@nicolas-grekas nicolas-grekas added this to the 4.3 milestone May 20, 2019
Copy link
Member

@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

If you have the failure transport configured, the message will immediately (after 1 try) go to the failure transport. Then, in theory, the developer would have time to look at that message, fix the problem, deploy, and retry it.

@Koc Koc force-pushed the feature/tune-doctrine-middlewares branch from cd87051 to d92efc0 Compare May 21, 2019 00:22
@fabpot
Copy link
Member

fabpot commented May 21, 2019

Tests are broken and should be fixed before merging (looks like a constraint should be changed in the Doctrine bridge).

@Koc Koc force-pushed the feature/tune-doctrine-middlewares branch from d92efc0 to c4eca27 Compare May 21, 2019 06:10
@Koc
Copy link
Contributor Author

Koc commented May 21, 2019

@fabpot thank you for suggestion, now fixed.

@fabpot
Copy link
Member

fabpot commented May 21, 2019

Thank you @Koc.

@fabpot fabpot merged commit c4eca27 into symfony:4.3 May 21, 2019
fabpot added a commit that referenced this pull request May 21, 2019
…dlingException when passed invalid entity manager name (Koc)

This PR was merged into the 4.3 branch.

Discussion
----------

[Messenger][DoctrineBridge] Throws UnrecoverableMessageHandlingException when passed invalid entity manager name

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | not sure
| Deprecations? | no
| Tests pass?   | Waiting for Travis
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

1. Throws `UnrecoverableMessageHandlingException` and do not retry messages if middlewares missconfigured
2.  `getManager()` doesn't return null. Actually [it throws](https://github.com/doctrine/persistence/blob/master/lib/Doctrine/Persistence/AbstractManagerRegistry.php#L144-L160) `\InvalidArgumentException` in requested entity manager not exists.

Not sure, should this changes considered as BC-break.

Also I can extract abstract Doctrine middleware but not sure what branch should I use for it? Master or 4.3?

Commits
-------

c4eca27 Throws UnrecoverableMessageHandlingException when passed invalid entity manager name for Doctrine middlewares
@fabpot fabpot mentioned this pull request May 22, 2019
@Koc Koc deleted the feature/tune-doctrine-middlewares branch July 16, 2019 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants