Hi
We are getting sometimes errors like this
OperationalError: could not translate host name "xxx.us-east-1.rds.amazonaws.com" to address: Try again
File "django/db/backends/base/base.py", line 213, in ensure_connection
self.connect()
File "django/db/backends/base/base.py", line 189, in connect
self.connection = self.get_new_connection(conn_params)
File "django/db/backends/postgresql/base.py", line 176, in get_new_connection
connection = Database.connect(**conn_params)
File "newrelic/hooks/database_dbapi2.py", line 101, in __call__
*args, **kwargs), self._nr_dbapi2_module, (args, kwargs))
File "appenlight_client/timing/timing_dbapi2.py", line 154, in __call__
self._e_object, *args, **kwargs),
File "appenlight_client/timing/__init__.py", line 137, in _e_trace
result = e_callable(*args, **kw)
File "psycopg2/__init__.py", line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory, async=async)
I am running this application in kubernetes cluster in top of AWS, so it is quite difficult to debug where this thing is going wrong. It might be, global DNS (which I think is not problem), kubernetes DNS or then just some bug in psycopq2.
However, I am kind of asking if this error message says "Try again" why the psycopq2 code is not retrying dns resolv itself(or is it retrying and we can ignore this error message)? Because this problem always starts to work when we get new request, and new connection request to database.
It is not the driver's responsibility to handle something like a reconnection policy. (how many times? for how long?) That's application business.