Bug #21547
Updated by Peter Amstutz 10 months ago
Certain database errors represent transient errors. We should tell the client to retry the request by returning a 500 internal server error instead of 422 (which is the default behavior).
#<ActiveRecord::Deadlocked: PG::TRDeadlockDetected: ERROR: deadlock detected>
Rationale: The observed deadlocks in Arvados are conflicts between two statements (a lock ordering issue), so unwinding and retrying is a reasonable solution
#<ActiveRecord::StatementInvalid: PG::UnableToSend>
Rationale: It seems this gets thrown when the API server can't connect to the database.
Here's the list of postgres errors known to the PG gem:
https://github.com/ged/ruby-pg/blob/daec80f91b9519509ca1694a231f11a75cb43f7f/ext/errorcodes.def#L598