-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
I have found these related issues/pull requests
none
Description
sqlx/sqlx-postgres/src/listener.rs
Lines 287 to 294 in 69bb595
if matches!( | |
err.kind(), | |
io::ErrorKind::ConnectionAborted | | |
io::ErrorKind::UnexpectedEof | | |
// see ERRORS section in tcp(7) man page (https://man7.org/linux/man-pages/man7/tcp.7.html) | |
io::ErrorKind::TimedOut | | |
io::ErrorKind::BrokenPipe | |
) => |
Is it intentional behavior to only match these IO error kinds when deciding whether to bubble it up or try to recover by reconnecting and returning Ok(None)
?
I stumbled upon this because I have a test that ensures correct behavior of my app in a specific race condition with a network failure to the DB, and on one machine it was working fine, while on another machine, with all things the same I was getting the ConnectionReset
error, which resulted in PgListener::try_recv
returning Err
instead of Ok(None)
and reconnecting, which is what I wanted.
Reproduction steps
PgListener::try_recv
- Simulate connection failure
- Sometimes this returns
Ok(None)
(expected) and sometimesErr
(unexpected)
SQLx version
master
Enabled SQLx features
postgres
Database server and version
postgres
Operating system
linux
Rust version
rustc 1.91.0-nightly (69b76df90 2025-08-23)