Skip to content

v0.8.18 — let a routing rule carry a large geosite category

Choose a tag to compare

@Free-Guy-IR Free-Guy-IR released this 18 Sep 15:21
· 692 commits to main since this release
9defaec

A routing rule could not carry a large geosite category

Installing a filter that names geosite:category-ads-all came back, on every node at once:

grpc: received message larger than max (4326122 vs. 4194304)

4194304 is grpc-go's default receive size. The ceiling is not this node's: controller/rpc/service.go has set MaxRecvMsgSize/MaxSendMsgSize to 64 MiB since upstream v0.2.0, and the node's own log line Method: AddRoutingRule, Code: ResourceExhausted proves it decoded the 4.33 MB message fine — that line comes from a unary interceptor, which grpc-go runs only after dec(in) has already enforced the limit.

The ceiling is Xray's own commander: app/commander/commander.go calls grpc.NewServer() with no options at all. A rule naming a geosite category is expanded into concrete domains before it reaches the core, and category-ads-all holds 170,624 of them.

Xray is now built from a pinned upstream tag with a two-line patch giving its commander the same 64 MiB this node already allows elsewhere. The build runs git apply --verbose and then greps for the result, so a patch that stops applying fails the build rather than silently shipping an unpatched core. The prebuilt binary the install script fetches still provides the geo assets; only the binary is replaced.

Proven end to end, not argued: built on the test host, the test node recreated on the patched image (Xray 26.3.27 … d2758a0-dirty), and the same 170,624-domain list applied — enforced: true, last_error: null, and the node logged Method: AddRoutingRule, Status: Success. The identical list fails on every unpatched node.

The gRPC server had no cap on concurrent streams

It ran at grpc-go's math.MaxUint32. Because the 64 MiB receive ceiling is enforced before the api-key interceptor runs — ClientAuth is NoClientCert, and the generated handler calls dec(in) before interceptor(...) — any peer that completed the TLS handshake could hold open unbounded concurrent 64 MiB allocations on hosts that publish the port. It is now GRPC_MAX_CONCURRENT_STREAMS, default 64, far above what one panel uses.

NodeVersion goes 0.6.16 → 0.6.18.