The problem reported in #1176 is the close recursion already fixed.
However, because we try to reconnect before closing, we end up scheduling
a reconnection attempt for every recursion loop.
The recursion shouldn't happen anymore, but it seems more robust to
reconnect after the connection has been successfully closed, otherwise
we might end up requesting more connections than we ought (hopefully not
as dramatically as here anyway).
- Fix infinite loop with connections modified to return on close
(:ticket:`#1124`).
+- Fix request of excessive connections upon connection close failing and
+ retrying (:ticket:`#1176`).
Current release
if conn.pgconn.transaction_status == TransactionStatus.UNKNOWN:
self._stats[self._CONNECTIONS_LOST] += 1
# Connection no more in working state: create a new one.
- self.run_task(AddConnection(self))
logger.info("not serving connection found broken")
+ self.run_task(AddConnection(self))
return
elif conn.pgconn.transaction_status == TransactionStatus.UNKNOWN:
self._stats[self._RETURNS_BAD] += 1
# Connection no more in working state: create a new one.
- self.run_task(AddConnection(self))
logger.warning("discarding closed connection: %s", conn)
+ self.run_task(AddConnection(self))
return
# Check if the connection is past its best before date
if conn._expire_at <= monotonic():
- self.run_task(AddConnection(self))
logger.info("discarding expired connection")
conn._pool = None
conn.close()
+ self.run_task(AddConnection(self))
return
self._add_to_pool(conn)
if conn.pgconn.transaction_status == TransactionStatus.UNKNOWN:
self._stats[self._CONNECTIONS_LOST] += 1
# Connection no more in working state: create a new one.
- self.run_task(AddConnection(self))
logger.info("not serving connection found broken")
+ self.run_task(AddConnection(self))
return
else:
if conn.pgconn.transaction_status == TransactionStatus.UNKNOWN:
self._stats[self._RETURNS_BAD] += 1
# Connection no more in working state: create a new one.
- self.run_task(AddConnection(self))
logger.warning("discarding closed connection: %s", conn)
+ self.run_task(AddConnection(self))
return
# Check if the connection is past its best before date
if conn._expire_at <= monotonic():
- self.run_task(AddConnection(self))
logger.info("discarding expired connection")
conn._pool = None
await conn.close()
+ self.run_task(AddConnection(self))
return
await self._add_to_pool(conn)