Skip to content

fix: guard snell pooled connection reuse state#2878

Merged
wwqgtxx merged 1 commit into
MetaCubeX:Alphafrom
xream:codex/fix-snell-server-eof
Jun 13, 2026
Merged

fix: guard snell pooled connection reuse state#2878
wwqgtxx merged 1 commit into
MetaCubeX:Alphafrom
xream:codex/fix-snell-server-eof

Conversation

@xream

@xream xream commented Jun 5, 2026

Copy link
Copy Markdown

当前 mihomo 使用 Snell reuse 连接官方 snell-server 时,在某些提前关闭路径下可能触发服务端报错:

Recevie client EOF before command, abort
Error: signal 11

@wwqgtxx wwqgtxx force-pushed the Alpha branch 3 times, most recently from f513c49 to d67572b Compare June 12, 2026 02:06
@xream xream force-pushed the codex/fix-snell-server-eof branch from 995cda3 to 75540c3 Compare June 13, 2026 11:42
Only return a Snell connection to the pool after the request header is written and the connection is marked reusable.
Close the raw connection when it is closed before a request starts or before it becomes reusable, so the next request cannot inherit incomplete state.
Add Close and CloseWrite tests for early close, close after half-close, and cases where the pool must not reuse the connection.
@xream xream force-pushed the codex/fix-snell-server-eof branch from 75540c3 to f064472 Compare June 13, 2026 11:59
@wwqgtxx wwqgtxx marked this pull request as ready for review June 13, 2026 12:11
@wwqgtxx wwqgtxx merged commit 2cd1443 into MetaCubeX:Alpha Jun 13, 2026
176 of 177 checks passed
missuo added a commit to missuo/mihomo that referenced this pull request Jun 14, 2026
Sync 15 commits from MetaCubeX/mihomo upstream (rematch outbound type,
routing-mark for listeners/dns, xhttp session-table/length, AmneziaWG
and OpenVPN crash fixes, etc.).

Resolve snell conflicts by combining the local connection-reuse changes
(uses cap + drain-before-reuse) with upstream's MarkReusable reusable-
state gate (MetaCubeX#2878): a pooled conn is now returned only after it is both
explicitly marked reusable and drained clean. Adapt the snell pool tests
to the new gate and keep upstream's reusable-state coverage.
icy37785 pushed a commit to icy37785/mihomo that referenced this pull request Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants