[10.x] Refine error messages for detecting lost connections (Debian bookworm compatibility) #53794
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Last year I added those two via #47398 Please see details and reasoning there, it still applies; TL;DR:
What I didn't knew back then was that the order/format of those messages very much dependent on the underlying libraries (libpq and or libssl presumably) and once we started to upgrade from Debian bullseye to bookworm, they changed and now are randomly interrupting our service again.
The new (complete) messages look like this:
That is, it still contains "SSL error: sslv3 alert unexpected message" but there's now connection specific information after the SQLSTATE prefix.
Since lost connection detection is based on exact string matching and not regex, we're just removing the magic numbers in front and still keep backwards compatibility.
Notes
Please accept this this PR against Laravel 10.x because we're still using and it requires the fix there (we're in the progress moving to L11, but it still takes time).
Thanks