Violation
try:
_connect_websocket(ws, url, timeout=10)
last_error = None
break
except Exception as exc:
last_error = exc
try:
ws.close()
except Exception:
pass
if attempt < max_attempts - 1:
...
Location
sdks/python/pmxt/ws_client.py:159-162, inside _ensure_connected
Why It Matters
When a connection attempt fails and the socket is being torn down before the next retry, any failure to close the half-open socket is discarded with no logging. This can hide resource leaks (unclosed sockets/file descriptors across retries) and makes it impossible to diagnose why a retry loop is behaving unexpectedly, since the only visible error becomes last_error from the connect failure, not the close failure.
Suggested Fix
Log the close failure at debug/warning level (consistent with how close() elsewhere in this file now handles cleanup errors, e.g. via logging.warning) instead of silently discarding it.
Found by automated code hygiene audit
Violation
Location
sdks/python/pmxt/ws_client.py:159-162, inside
_ensure_connectedWhy It Matters
When a connection attempt fails and the socket is being torn down before the next retry, any failure to close the half-open socket is discarded with no logging. This can hide resource leaks (unclosed sockets/file descriptors across retries) and makes it impossible to diagnose why a retry loop is behaving unexpectedly, since the only visible error becomes
last_errorfrom the connect failure, not the close failure.Suggested Fix
Log the close failure at debug/warning level (consistent with how
close()elsewhere in this file now handles cleanup errors, e.g. vialogging.warning) instead of silently discarding it.Found by automated code hygiene audit