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

MBS-13453: Avoid double-decoding some errors #3323

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

reosarevok
Copy link
Member

Fix MBS-13453

Problem

We are getting wide error ISEs that hide the real errors sometimes when there are PSQL problems.

Solution

While the idea in 20640de was correct, the change was too wide in application; it was also decoding errors that did not need it, causing a wide character ISE because of the double decoding.

The actual cause of the double encodings we saw with MBS-11207 seems to be Devel::StackTrace::as_string - so this just decodes those error strings rather than all of them.

Testing

Manually.

This specific issue can be triggered for testing by changing the host in DBDefs to something dumb and utf8ish. I used '♥localhost'.

The double-decoding could be triggered (before this patch) by doing a similar change on a .sql data file for a test and then running it - I changed work.sql to have an invalid artist ID (to trigger an error) and '♥' instead of 'ABBA' as an AC name. Then I just triggered the error with prove -lv t/tests.t :: --tests Edit::Work::Create

While the idea in 20640de
was correct, the change was too wide in application;
it was also decoding errors that did not need it, causing
a wide character ISE because of the double decoding.

The actual cause of the double encodings we saw with MBS-11207
seems to be Devel::StackTrace::as_string - so this just decodes *those* error strings
rather than all of them.

This specific issue can be triggered for testing by changing the host in DBDefs to something dumb and utf8ish.
I used '♥localhost'.

The double-decoding could be triggered (before this patch)
by doing a similar change on a sql data file for a test and then
running it - I changed work.sql to have an invalid artist ID
(to trigger an error) and ♥ instead of ABBA as an AC name.
Then I just triggered the error with
prove -lv t/tests.t :: --tests Edit::Work::Create
@reosarevok reosarevok added the Bug Bugs that should be checked/fixed soonish label Jul 10, 2024
Copy link
Contributor

@yvanzo yvanzo left a comment

Choose a reason for hiding this comment

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

Thank you! Changes makes perfect sense.

Would it be feasible to make the test described in commit message a CI test?

lib/MusicBrainz/Server/Connector.pm Outdated Show resolved Hide resolved
Co-authored-by: yvanzo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bugs that should be checked/fixed soonish
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants