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

Original exception is swallowed due rollback exception #11423

Closed
ro0NL opened this issue Apr 24, 2024 · 11 comments
Closed

Original exception is swallowed due rollback exception #11423

ro0NL opened this issue Apr 24, 2024 · 11 comments

Comments

@ro0NL
Copy link

ro0NL commented Apr 24, 2024

Bug Report

Q A
BC Break no
Version 2.19

Summary

When rollback fails (eg. due SAVEPOINT DOCTRINE_2 does not exist) at

$conn->rollBack();
the original exception is swallowed, which breaks debugging.

Current behavior

Swallowed exception

How to reproduce

Expected behavior

Try/catch rollback and log its exception, so the original exception is actually thrown.

@greg0ire
Copy link
Member

log its exception

What if the logging fails? 😛

Right now there isn't a logger available in the Unit of Work, so I'm not sure how we could go about this…

@ro0NL
Copy link
Author

ro0NL commented Apr 24, 2024

i think this is related to #7545 in a way, but i dont know for sure, because the original exception is swallowed

regardless, the original exception should not be swallowed

depending on a nullable PSR logger contract seems fine?

try/catching log failures is an implementation detail per logger, we should consider it safe-calls

@greg0ire
Copy link
Member

I had 2 unworded thoughts I saw mentioned by Ocramius in #7545:

  • the rollback failing might be much worse and should have priority over the other exception
  • instead of logging, we could throw an exception that mentions both exceptions

Reading the other threads, I see that deferred constraints are involved, is that your case as well?

@ro0NL
Copy link
Author

ro0NL commented Apr 24, 2024

from doctrine/dbal#3423

we lose information about what error happened in the first place

this is the bug

@ro0NL
Copy link
Author

ro0NL commented Apr 24, 2024

I see that doctrine/dbal#3423 are involved, is that your case as well?

i dont know, because the original exception is swallowed

we could throw an exception that mentions both exceptions

anything goes :) as long as we expose the original exception

the rollback failing might be much worse and should have priority over the other exception

i dont know, because the original exception is swallowed

this could be some post-flush event exception

@greg0ire
Copy link
Member

After following the rabbit hole, I think the current work on what I think might be the root cause is #4846

i dont know, because the original exception is swallowed

Are you using Postgres?

anything goes :) as long as we expose the original exception

Sound good, feel free to send a PR.

@ro0NL
Copy link
Author

ro0NL commented Apr 24, 2024

is it considered a bugfix for 2.19?

@greg0ire
Copy link
Member

Hmmm… I guess it could be seen as a DX improvement, but one that could help us understand bugs in Doctrine.
Why do you ask? Are you stuck on 2.x for now?

@ro0NL
Copy link
Author

ro0NL commented Apr 25, 2024

Are you stuck on 2.x for now?

yup

@ro0NL
Copy link
Author

ro0NL commented Apr 26, 2024

@ro0NL
Copy link
Author

ro0NL commented Apr 26, 2024

closing in favor of #7545, which has the bug label

@ro0NL ro0NL closed this as completed Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants