-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Error sink not called unless debugger is attached with breakpoints #151
Comments
Sorry about that -- sounds like some kind of odd race condition is making it timing-dependent? I'm afraid I won't have much time to investigate, but happy to support you if you're able to dig in more. I think this might be the same as #141? |
This is a partial fix for #496 * BREAKING: Now Martin behaves the same way as `psql` -- by default, if SSL is available on the server, it will be used, even though it will not verify that the server has a valid SSL certificate * Martin now understands `PGSSLCERT`, `PGSSLKEY`, and `PGSSLROOTCERT` env vars (and corresponding config keys) - same as psql. * Martin can now process `?sslmode=verify-ca` and `verify-full` (just like psql). The verify modes require root and/or client cert & key. * remove `danger_accept_invalid_certs` -- turns out that behavior is expected by default unless ssl mode is set to verify - which upstream lib [does not support](sfackler/rust-postgres#768) - PR [submitted](sfackler/rust-postgres#988). * added connection_timeout_ms option for postgres and set it to 5 seconds by default. This way it will fail out earlier. * added error reporting to bb8 - but it is currently [broken upstream](djc/bb8#151) - not sure we can fix it easily, so may need to switch to deadpool later. * added docker-based TLS test (horray!) - wasn't trivial at all, despite ending up fairly simple.
Yes this looks very much the same as #141. It looks like the debugger's breakpoints allow the error to be dispatched to the sink before the main future completes, but this is unlikely to happen in the general case for the same reasons I describe there. |
This code reproduces the issue fairly reliably on my Linux box with Rust 1.67. For debugging I used IntelliJ, but I don't know if the same behavior is on VS code.
Error Sink is not called when PostgreSQL reports a connection error on
pool.get()
, unless I run this code in a debugger with two breakpoints set. Instead of the actual PG error, it reports a timeout error without calling the error sink.Make sure to run postgres in a docker container (see message in code). The two commented-out test lines work fine.
Running without debugger
The above code prints
Error: TimedOut
Running with debugger
I was able to see the error sink error if I set two breakpoints in the debugger (I used IntelliJ) -- note that both breakpoints are required for this to work.
bb8/bb8/src/inner.rs
Line 67 in 5737736
Run the code and keep hitting F9 (Resume), and it prints this:
The text was updated successfully, but these errors were encountered: