XX-net/XX-Net · warning

report_connect_closed %s sni:%s reason:%s except:%r

Error message

report_connect_closed %s sni:%s reason:%s except:%r

What it means

Wrapped warn when report_connect_closed itself raised while updating link counts (e.g. unknown IP/SNI key). Inner error branch also logs when links would go negative, indicating more closes than opens.

Source

Thrown at code/default/x_tunnel/local/cloudflare_front/ip_manager.py:138

            self.logger.error("report_connect_fail %s sni:%s links:%d reason:%s", ip, sni, info["links"], reason)
        else:
            info["links"] -= 1
        self.logger.debug("ip %s sni:%s connect fail, reason:%s", ip, sni, reason)

    def report_connect_closed(self, ip_str, sni=None, reason=""):
        ip, _ = utils.get_ip_port(ip_str)
        ip = utils.to_str(ip)
        top_domain = ".".join(sni.split(".")[1:])

        try:
            info = self._get_domain(top_domain)
            if info["links"] <= 0:
                self.logger.error("report_connect_closed %s sni:%s links:%d reason:%s", ip, sni, info["links"], reason)
            else:
                info["links"] -= 1
            self.logger.debug("ip %s sni:%s connect closed reason %s", ip, sni, reason)
        except Exception as e:
            self.logger.warn("report_connect_closed %s sni:%s reason:%s except:%r", ip_str, sni, reason, e)

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. Restart the front to rebuild ip state
  2. Ensure report_connect_created/closed are paired
  3. If persistent, clear saved ip_manager state files
Defensive patterns

Strategy: try-catch

Try / catch

try:
    mgr.report_connect_closed(ip, sni, reason)
except Exception:
    pass  # state already gone; rebuild on restart

Prevention

When it happens

Trigger: A connection closes with an ip/sni combination not in the pool, or double close decrements below zero.

Common situations: State file out of sync with runtime connections after crash/restart; IP evicted while connections still open.

Related errors


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