oxidecomputer / oxidecomputer/omicron
how does diesel report network errors during a query?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
While working on #262, I was looking at the Diesel error types, and I'm a little worried about what happens if there's a network error while a query is outstanding. That would include a fatal error on the socket (e.g., ETIMEDOUT or ECONNRESET) encountered either while attempting to write the request (this is one of the harder ones to test) or while attempting to read response data back. It could also include protocol violations resulting from sockets gracefully closed (e.g., because CockroachDB crashed) at a point that's not legal for the protocol.
I'm worried because diesel::Result::Error claims to cover "all the ways that a query can fail". None of the variants looks suitable to these network issues. The closest one is "DatabaseError", but that's documented as "the database returned an error" -- that's not what will happen in this case. And if we look at the variants of that (well, really DatabaseErrorKind), again, it's not clear which one would fit. In the main branch there are a few other variants, including ClosedConnection, but the docs say "This error is only detected for PostgreSQL and is emitted on a best-effort basis and may be missed." I'm not sure what that means.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Diesel's diesel::Result::Error and DatabaseErrorKind documentation linked in the issue, then inspect diesel/src/result.rs on the referenced main branch. Determine how write failures, read failures, and protocol violations during an outstanding query should be represented; the issue does not define a specific desired API or completion test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend, databases, networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100