-
Notifications
You must be signed in to change notification settings - Fork 22k
Description
Steps to reproduce
Since upgrading from Rails 7.0 to 7.1 we've started to see the following exception:
# activerecord (7.1.3.2) lib/active_record/connection_adapters/postgresql_adapter.rb in get_oid_type
undefined method `key?' for nil:NilClass (NoMethodError)
if !type_map.key?(oid)
^^^^^
I haven't been able to replicate the behavior outside of production where it occurs when the application briefly loses its connection to the postgres database while under load. This is a multi-threaded environment. The server never recovers after entering this state.
I know there was a change to type_map initialization at dc4420c, and it looks to me like it's possible there's a race condition here. I'll update this issue with steps to replicate if I can manage to trigger this outside of production.
Expected behavior
The application should recover from a brief database outage and reconnect.
Actual behavior
The server is never able to reconnect.
System configuration
Rails version: 7.1.3.2
Ruby version: 3.2.4
martinvium, kazumalab, quentindemetz, joshuafleck, sirdharma and 32 moreMSILycanthropy, adillari, hampld and Paul-Bobnik-holo, frodsan, carlosramireziii, dipth, Vagab and 4 more