sfackler / r2d2

A generic connection pool for Rust
Apache License 2.0
1.51k stars 82 forks source link

pool.get() returns Error(None) -- best debugging strategy? #113

Closed sezna closed 3 years ago

sezna commented 4 years ago

Hi sfackler, thanks again for r2d2 -- it is obviously a great tool crucial to lots of places that use Rust.

I'm running into an error where pool.get() returns Error(None), which is unfortunately not helping me track down the issue. Pool::new() works, and my migrations using the same DB url are working (so the DB and URL are indeed correct). My migrations use diesel, which internally doesn't use r2d2 to migrate, so it seems the issue is in the pooling itself.

My question is: is there a way to turn on some more advanced logging for either r2d2, or, if you happen to know, in libpq? Or to track down an issue like this?

sfackler commented 4 years ago

You can register an error handler: https://docs.rs/r2d2/0.8.9/r2d2/struct.Builder.html#method.error_handler to get information about the errors the pool encounters trying to open connections. Not sure about libpq.

The None in the Error would I think imply that the connection attempts are not returning.