diff --git a/lbry/wallet/network.py b/lbry/wallet/network.py index 2edf92eba..be27fcdcf 100644 --- a/lbry/wallet/network.py +++ b/lbry/wallet/network.py @@ -90,6 +90,7 @@ class ClientSession(BaseClientSession): while True: try: if self.is_closing(): + log.warning("is closing, reconnect") await self.create_connection(self.timeout) await self.ensure_server_version() self._on_connect_cb() @@ -99,10 +100,14 @@ class ClientSession(BaseClientSession): except RPCError as e: log.warning("Server error, ignoring for 1h: %s:%d -- %s", *self.server, e.message) retry_delay = 60 * 60 - except (asyncio.TimeoutError, OSError): + except asyncio.TimeoutError: + log.error("closing due to timeout") await self.close() retry_delay = min(60, retry_delay * 2) log.warning("Wallet server timeout (retry in %s seconds): %s:%d", retry_delay, *self.server) + except Exception: + log.exception("unexpected error") + raise try: await asyncio.wait_for(self.trigger_urgent_reconnect.wait(), timeout=retry_delay) except asyncio.TimeoutError: diff --git a/lbry/wallet/rpc/session.py b/lbry/wallet/rpc/session.py index 97a20c545..afde385b0 100644 --- a/lbry/wallet/rpc/session.py +++ b/lbry/wallet/rpc/session.py @@ -115,6 +115,7 @@ class SessionBase(asyncio.Protocol): try: await asyncio.wait_for(self._can_send.wait(), secs) except asyncio.TimeoutError: + self.logger.warning("abort connection after limited wait (%s)", secs) self.abort() raise asyncio.TimeoutError(f'task timed out after {secs}s')