Skip to content

Catch pooled connection errors in Connection.Manager process #2804

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 6 commits into from
Jun 16, 2025

Conversation

alco
Copy link
Member

@alco alco commented Jun 5, 2025

Fix #1554, #2727.

Copy link

codecov bot commented Jun 5, 2025

Codecov Report

Attention: Patch coverage is 35.00000% with 13 lines in your changes missing coverage. Please review.

Project coverage is 78.27%. Comparing base (7e8c4f4) to head (b66b36f).
Report is 7 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...es/sync-service/lib/electric/connection/manager.ex 41.66% 7 Missing ⚠️
...s/sync-service/lib/electric/db_connection_error.ex 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2804      +/-   ##
==========================================
- Coverage   78.32%   78.27%   -0.05%     
==========================================
  Files         154      154              
  Lines        7270     7288      +18     
  Branches      275      273       -2     
==========================================
+ Hits         5694     5705      +11     
- Misses       1574     1581       +7     
  Partials        2        2              
Flag Coverage Δ
elixir 77.19% <35.00%> (-0.05%) ⬇️
elixir-client 72.58% <ø> (+0.57%) ⬆️
packages/experimental 87.73% <ø> (ø)
packages/react-hooks 86.30% <ø> (ø)
packages/typescript-client 92.41% <ø> (ø)
packages/y-electric 55.12% <ø> (ø)
postgres-140000 77.32% <35.00%> (-0.15%) ⬇️
postgres-150000 77.45% <35.00%> (-0.17%) ⬇️
postgres-170000 77.39% <35.00%> (-0.22%) ⬇️
sync-service 77.77% <35.00%> (-0.13%) ⬇️
typescript 84.36% <ø> (ø)
unit-tests 78.27% <35.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alco alco force-pushed the alco/pooled-connection-errors branch 5 times, most recently from 3ffca87 to d971d3c Compare June 11, 2025 10:44
@alco alco marked this pull request as ready for review June 11, 2025 10:48
@alco alco force-pushed the alco/pooled-connection-errors branch from d971d3c to b66b36f Compare June 11, 2025 10:49
@alco alco changed the title POC: catch pooled connection errors in Connection.Manager process Catch pooled connection errors in Connection.Manager process Jun 11, 2025
state
)

# If the error is of an unknown type, it would have already been logged by DbConnectionError itself.
Copy link
Contributor

Choose a reason for hiding this comment

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

We've been chatting back and forth about disabling library logging. I think with this PR and catching all the unknown errors from the lib we can disable it safely. Shall we do that as part of this PR? cc @robacourt

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds like a good idea to me

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, I'm not sure I get what is meant by disabling library logging here.

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Set capture_log_messages to false
  2. Come up with an alternative means to send errors to Sentry when we want to (when we currently just log an error)

Because 2 is not trivial, perhaps it should be a separate PR.

Copy link
Contributor

@robacourt robacourt left a comment

Choose a reason for hiding this comment

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

Nice work!

@alco alco merged commit 4a6e5b1 into main Jun 16, 2025
39 checks passed
@alco alco deleted the alco/pooled-connection-errors branch June 16, 2025 14:30
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

Successfully merging this pull request may close these issues.

Improve db connection error visibility
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy