GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — SSEClient.shutdown() raises OSError: [Errno 107] Transport endpoint is not connected when the SSE socket is already disconnected · Issue #645 · splitio/python-client Open DescriptionSummary
Because it originates in a background thread, application code cannot catch it. It surfaces as an unhandled exception (e.g. reported to Sentry / crash reporters) even though it is harmless — the connection we are trying to shut down is already gone. Environment
StacktraceRoot cause
def shutdown(self): """Shutdown the current connection.""" if self._conn is None or self._conn.sock is None: _LOGGER.warning("no sse connection has been started on this SSEClient instance. Ignoring") return if self._shutdown_requested: _LOGGER.warning("shutdown already requested") return self._shutdown_requested = True self._conn.sock.shutdown(socket.SHUT_RDWR) # <-- raises ENOTCONN if peer already closed The method guards for Steps to reproduceThis is a race between the server/network closing the SSE stream and the client's own shutdown path, so it is timing-dependent. It reliably occurs in production whenever the streaming connection is dropped remotely and the feedback handler subsequently calls import socket s = socket.create_connection(("example.com", 80)) s.close() # peer/local endpoint no longer connected s.shutdown(socket.SHUT_RDWR) # OSError: [Errno 107] Transport endpoint is not connected Suggested fixWrap the self._shutdown_requested = True try: self._conn.sock.shutdown(socket.SHUT_RDWR) except OSError as exc: # Socket already disconnected (e.g. ENOTCONN 107) — nothing to shut down. _LOGGER.debug("SSE socket already disconnected during shutdown: %s", exc) Happy to open a PR with this change plus a regression test if it's helpful. ActivityMetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |