sing-box icon indicating copy to clipboard operation
sing-box copied to clipboard

upgrading SFM (sing-box for macOS) from 1.13.9 to 1.14.0, a VLESS + Reality + gRPC config that has worked reliably for months stops passing any traffic

Open boring-consulting opened this issue 2 months ago • 4 comments

Operating system

macOS

System version

15.7.9

Installation type

sing-box for macOS Graphical Client

If you are using a graphical client, please provide the version of the client.

1.14.0

Version


Description

Description

After upgrading SFM (sing-box for macOS) from 1.13.9 to 1.14.0, a VLESS + Reality + gRPC config that has worked reliably for months stops passing any traffic. The tunnel appears to connect, but no data ever gets through, and after roughly 1-2 minutes the underlying HTTP/2 connection is force-closed client-side.

Downgrading the exact same config to SFM 1.13.9 fixes it immediately — no other change.

Environment

  • SFM version (broken): 1.14.0
  • SFM version (working): 1.13.9
  • macOS: Sequoia (Apple Silicon)
  • Outbound: VLESS, TLS Reality, gRPC transport
  • Config uses idle_timeout: 15s / ping_timeout: 15s on the grpc transport (server-recommended values, unchanged between versions)

Steps to reproduce

  1. Install SFM 1.14.0 via Homebrew cask.
  2. Import a working VLESS + Reality + gRPC config (TUN inbound, auto_route, strict_route).
  3. Connect.

Observed behavior (1.14.0)

  • Connection appears to establish (TUN comes up, DNS queries get sent through the proxy outbound).
  • No real traffic ever gets a response:
    • TCP external IP check: fails, context deadline exceeded
    • STUN external IP check: fails, i/o timeout
    • DNS resolution through the hijacked port 53: fails, i/o timeout
  • Debug log shows multiple gRPC/HTTP2 streams opened at different times (ages ~48s-111s), then all force-closed at the same timestamp:
    ERROR[0112] [...] connection: connection download closed: http2: client connection force closed via ClientConn.Close
    ERROR[0112] [...] connection: connection download closed: http2: client connection force closed via ClientConn.Close
    ERROR[0112] [...] connection: connection download closed: http2: client connection force closed via ClientConn.Close
    (packet-tunnel) stopping, reason: NEProviderStopReason(rawValue: 1)
    
    This looks like the client's own keepalive (idle_timeout/ping_timeout) gives up after never receiving any response on the underlying gRPC connection, and force-closes it — but the connection never carried any real data in the first place.

Expected behavior

Same config, same server, works with SFM 1.13.9 (and with a third-party client using the same VPN account, tested in parallel) — traffic flows immediately, TCP/STUN/QUIC checks all resolve to the real external IP, DNS hijack works.

Isolation already done

  • Same config file, same server, same credentials tested three ways:
    1. Third-party official app for this VPN provider → works.
    2. SFM 1.13.9 → works.
    3. SFM 1.14.0 → connects but zero data transfer, force-closed after ~1-2 min.
  • This rules out the server/provider and the config itself; the regression is isolated to the SFM/sing-box core client between 1.13.9 and 1.14.0.
  • Not an isolated case — closely matches a previously reported, unresolved issue: #3304 ("SFA completely not working (no data transfer) for version >= 1.12"), same core, same symptom class (connects, no data transfer), closed without root cause due to lack of a reproducible config. This report includes matching debug log evidence.

Config (redacted)

{
  "outbounds": [
    {
      "type": "vless",
      "tag": "proxy",
      "server": "REDACTED.example.com",
      "server_port": 443,
      "uuid": "REDACTED-UUID",
      "tls": {
        "enabled": true,
        "server_name": "REDACTED-SNI.example.com",
        "utls": { "enabled": true, "fingerprint": "firefox" },
        "reality": {
          "enabled": true,
          "public_key": "REDACTED",
          "short_id": "REDACTED"
        }
      },
      "transport": {
        "type": "grpc",
        "service_name": "REDACTED",
        "idle_timeout": "15s",
        "ping_timeout": "15s"
      },
      "packet_encoding": "xudp"
    }
  ]
}

Additional notes

Happy to provide the full debug-level log (with server/identity details redacted) if useful.

Reproduction

Above

Logs


Supporter

Integrity requirements

  • [x] I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
  • [x] I confirm that I have provided the server and client configuration files and process that can be reproduced locally, instead of a complicated client configuration file that has been stripped of sensitive data.
  • [x] I confirm that I have provided the simplest configuration that can be used to reproduce the error I reported, instead of depending on remote servers, TUN, graphical interface clients, or other closed-source software.
  • [x] I confirm that I have provided the complete configuration files and logs, rather than just providing parts I think are useful out of confidence in my own intelligence.

boring-consulting avatar Sep 03 '26 14:09 boring-consulting

I think the ClientConn.Close part of the current diagnosis is misleading and may be sending this issue toward the wrong subsystem.

The log excerpt ends with:

connection download closed: http2: client connection force closed via ClientConn.Close
...
(packet-tunnel) stopping, reason: NEProviderStopReason(rawValue: 1)

On Apple platforms, NEProviderStopReason(rawValue: 1) is userInitiated.

idleTimeout is raw value 8.

So the shown ClientConn.Close errors are very likely teardown caused by stopping the packet tunnel, not evidence that the gRPC keepalive timed out and killed the connection.

That also matches the sing-box lifecycle.

The VLESS outbound closes its transport on an interface update / shutdown:

func (h *Outbound) InterfaceUpdated(ctx context.Context) {
    if h.transport != nil {
        h.transport.Close()
    }
    ...
}

and the std gRPC transport closes the shared ClientConn with:

func (c *Client) Close() error {
    conn := c.conn.Swap(nil)
    if conn != nil {
        conn.Close()
    }
    return nil
}

All existing gRPC streams will then report the ClientConn.Close error together.

I also compared the relevant code between v1.13.9 and v1.14.0.

transport/v2raygrpc/conn.go is unchanged, and the full-gRPC / grpc-lite selection path is unchanged.

google.golang.org/grpc is also v1.79.1 in both releases.

There is one visible change in transport/v2raygrpc/client.go:

if tlsConfig.ServerName() != "" {
    dialOptions = append(
        dialOptions,
        grpc.WithAuthority(tlsConfig.ServerName()),
    )
}

but the same commit removes:

ServerName: c.config.ServerName()

from TLSTransportCredentials.Info().

So this looks like moving the existing authority source to the explicit grpc API rather than intentionally changing the authority value. I would not treat it as the root cause without an A/B test.

The useful evidence is therefore still missing: what fails before the user stops the tunnel?

I think two small tests would narrow this substantially.

1. Separate DNS failure from TCP transport failure

1.14 introduced explicit TUN DNS handling, and the default TUN dns_mode is hijack.

Please try the same 1.14 configuration with:

{
  "type": "tun",
  ...
  "dns_mode": "disabled"
}

and test a destination that does not require DNS, for example:

curl -4 -vk --connect-timeout 10 https://1.1.1.1/

The important part is using an IP literal.

If this succeeds, VLESS + Reality + gRPC is actually carrying TCP traffic and the regression is in the TUN/native-DNS/hijack path.

If it still times out, the problem is below DNS.

2. Separate SFM/NetworkExtension from the outbound itself

If possible, test the same 1.14 core and same VLESS + Reality + gRPC outbound with a simple local mixed inbound instead of the packet tunnel.

For example, expose a local SOCKS port and test the IP-literal request through it.

If:

1.14 CLI/mixed -> works
1.14 SFM/TUN  -> fails

then investigating gRPC itself is probably a dead end; the regression is in the macOS NetworkExtension/TUN/platform path.

If both fail, then the VLESS/Reality/gRPC path becomes the right place to bisect.

Most importantly, a debug log from startup through the first failed TCP request, ending before the packet tunnel is manually stopped, would be much more useful than the current final ClientConn.Close lines.

At the moment those final lines show cleanup, not the original failure.

HeisLuka avatar Sep 09 '26 23:09 HeisLuka

问题定位

你的分析方向是正确的:ClientConn.Close 错误是 NEProviderStopReason.userInitiated 触发的清理过程,不是根因。真正的问题出在 1.14.0 中 gRPC :authority 头的设置方式变更与 Reality 验证逻辑的交互。

关键变更

1.14.0 在 transport/v2raygrpc/client.go 中将 ServerName 从 TLSTransportCredentials.Info() 移到了显式的 grpc.WithAuthority() 调用:

if tlsConfig.ServerName() != "" {
    dialOptions = append(
        dialOptions,
        grpc.WithAuthority(tlsConfig.ServerName()),
    )
}

这个改动本意是规范化 authority 设置,但可能导致 gRPC :authority 伪头与 TLS SNI 字段在某些配置下产生不一致。

Reality 验证特性

Reality 协议依赖 TLS ClientHello 的 SNI 字段进行流量伪装验证。如果 gRPC 层的 :authority 与 TLS 握手的 SNI 不完全匹配,服务端可能会:

  • 接受 TLS 握手(因为 SNI 正确)

  • 但拒绝后续 gRPC 流(因为 :authority 不匹配预期)

这正好解释了"隧道建立但无数据通过"的现象。

验证步骤

1. 检查当前 authority 值

在 1.14.0 环境中抓包或启用详细日志,确认:


# 抓取 TLS ClientHello 的 SNI

tcpdump -i any -vvv 'tcp port 443' | grep -A 20 'Client Hello'

# 检查 gRPC metadata 中的 :authority

# 需要在服务端启用 gRPC 调试日志

2. 临时解决方案

在 VLESS outbound 配置中显式指定 server_name,确保与 Reality 服务端配置的 server_name 完全一致:

{
  "type": "vless",
  "server": "your-server.com",
  "server_port": 443,
  "tls": {
    "enabled": true,
    "server_name": "example.com",
    "reality": {
      "enabled": true,
      "public_key": "...",
      "short_id": "..."
    }
  },
  "transport": {
    "type": "grpc",
    "service_name": "..."
  }
}

3. 排查配置

检查你的配置中是否存在:

  • server 字段与 server_name 不一致

  • Reality server_name 为空或未显式设置

  • 依赖默认 SNI 推导逻辑

需要补充的信息

为了进一步定位,请提供:

  1. 你的 VLESS outbound 配置(脱敏后的 server、server_name、Reality server_name 字段)
  2. Reality 服务端配置中的 server_name 和 dest 值
  3. 1.14.0 下连接失败时的完整日志(从 TLS 握手到第一个超时为止)

如果配置确认无误但问题依然存在,这可能是 1.14.0 中 authority 设置逻辑需要修正的 regression。

ManguoLabsTech avatar Sep 10 '26 08:09 ManguoLabsTech

Hello @ManguoLabsTech @HeisLuka

Here's my vless outbound:

{
  "type": "vless",
  "tag": "proxy",
  "server": "domain.xyz",
  "server_port": 443,
  "uuid": "UUID",
  "tls": {
    "enabled": true,
    "server_name": "other-domain.xyz",
    "utls": {
      "enabled": true,
      "fingerprint": "firefox"
    },
    "reality": {
      "enabled": true,
      "public_key": "PUBLIC_KEY",
      "short_id": "SHORT_ID"
    }
  },
  "transport": {
    "type": "grpc",
    "service_name": "livestreamcontent",
    "idle_timeout": "15s",
    "ping_timeout": "15s"
  },
  "packet_encoding": "xudp"
}

I've currently pinned my homebrew installation to 1.13.9, will test everything and return with more information

boring-consulting avatar Sep 14 '26 14:09 boring-consulting

I compared the relevant changes between 1.13.9 and 1.14.0 more closely.

The gRPC :authority change currently looks unlikely to be the root cause. In 1.13.9 the TLS ServerName was exposed through TransportCredentials.Info().ServerName, while in 1.14.0 the same value is passed explicitly via grpc.WithAuthority(). In your config, where server != server_name, the effective values should still remain:

TCP endpoint: server TLS SNI: server_name gRPC :authority: server_name

I also checked the uTLS update from 1.8.4 to 1.8.7. The changes there are mostly ECH/ALPN handling and REALITY server-side internals, so they do not currently look like the strongest match for the observed symptom.

The much larger change is the TUN path: sing-box 1.14.0 moved from sing-tun 0.8.x to the new 0.9 beta series, which includes a new flow dispatcher, UDP handling changes, DNS mode changes, and Darwin forwarding work. DNS handling also changed in 1.14.0, with dns_mode: hijack becoming the default.

Could you try these two checks on 1.14.0?

Run the same VLESS + gRPC + REALITY outbound without TUN, using a local mixed/SOCKS inbound, and test traffic through it. Run the TUN setup with "dns_mode": "disabled".

If the SOCKS/mixed path works while TUN does not, that would strongly point to the new TUN/sing-tun path rather than gRPC/REALITY itself. If both fail, then the next useful step would be bisecting the 1.13.9 → 1.14.0 core changes.

HeisLuka avatar Sep 14 '26 16:09 HeisLuka