XX-net/XX-Net · warning

unregister %s e:%r

Error message

unregister %s e:%r

What it means

During ConnectionPipe stop, unregistering a socket from the selector raised (usually because the fd was already closed/unregistered). Cleanup continues for remaining sockets; this is mostly benign shutdown noise.

Source

Thrown at code/default/x_tunnel/local/base_container.py:573

                            self._debug_log("Conn session:%s conn:%d local recv len:%d pos:%d",
                                            self.session.session_id, conn.conn_id, data_len, conn.received_position)

                            conn.transfer_received_data(data)
                    elif event & selectors.EVENT_WRITE:
                        conn.blocked = False
                        conn.process_cmd()
                    else:
                        self.xlog.debug("no event for conn:%d", conn.conn_id)
                        self.close_sock(sock, "no_event")

            except Exception as e:
                xlog.exception("recv_worker e:%r", e)

        for sock in dict(self.sock_conn_map):
            try:
                self.select2.unregister(sock)
            except Exception as e:
                xlog.warn("unregister %s e:%r", sock, e)
        self.sock_conn_map = {}
        self._debug_log("ConnectionPipe stop")
        self.th = None
        self.session.check_upload()


class Conn(object):
    def __init__(self, session, conn_id, sock, host, port, windows_size, windows_ack, is_client, xlog):
        # xlog.info("session:%s conn:%d host:%s port:%d", session.session_id, conn_id, host, port)
        self.host = host
        self.port = port
        self.session = session
        self.conn_id = conn_id
        self.sock = sock
        self.windows_size = windows_size
        self.windows_ack = windows_ack
        self.is_client = is_client

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. Ignore if only seen at shutdown
  2. Check for double close/unregister paths if seen during runtime
  3. Ensure stop() is idempotent
Defensive patterns

Strategy: try-catch

Try / catch

try:
    select2.unregister(sock)
except Exception:
    pass  # fd already gone during shutdown

Prevention

When it happens

Trigger: pipe_worker teardown loops over sock_conn_map and calls select2.unregister on sockets already closed elsewhere.

Common situations: Normal during process exit or tunnel restart; can indicate double-unregister races if frequent during operation.

Related errors


AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27). Data as JSON: /api/errors/8c1c4fcf54048b41. Report an issue: GitHub.