Repository navigation
XTLS Vision: Serialize VisionWriter writes from concurrent mux sessions - #7337
Merged
Merged
Conversation
Removed a comment about Mux workers in proxy.go.
Member
|
@Fangliding 看你有 commit,能合了吗 |
Member
|
我看了下,可以先作为修复合并,不过 core 里不该有 concurrent write or read 这种东西,仍需修复深层起因(可能就是这种东西导致了 #5845 ,你试着修下), |
Hei-XiaoHu
pushed a commit
to Hei-XiaoHu/Xray-core
that referenced
this pull request
Nov 7, 2026
…ns (XTLS#7337) XTLS#7337 (comment) Fixes XTLS#7336 cherry-pick upstream 1c8bf40 --------- Co-authored-by: 风扇滑翔翼 <[email protected]> Co-authored-by: RPRX <[email protected]>
This was referenced Nov 7, 2026
🐛 [fix] APP-1209: grow tcp window past jitter, quiet peers and pauses
SnowLukin/amnezia-xray-core#15
Merged
Contributor
Author
RPRX
added a commit
that referenced
this pull request
Nov 8, 2026
…tes to the underlayer #7337 (comment) #7345 (comment) Fixes #5845 and #7336 --------- Co-authored-by: StarProxima <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7336
Since 4064f8d the VLESS inbound hands its
VisionWritertomux.Server.DispatchLinkwithout a pipe.mux.ServerWorkerwrites from one goroutine per session, soVisionWriter.WriteMultiBufferruns concurrently. The padding state (writeOnceUserUUID,IsPadding,NumberOfPacketToFilter) changes outside any lock, while theBufferedWriterlock underneath only covers the socket write. Blocks then reach the wire in a different order from the one their padding was computed in. The clientVisionReaderpasses padding through as data, and the client mux fails withunknown status: <random>, dropping every session on the connection. Details, configs and logs are in the issue.This PR makes
VisionWriter.WriteMultiBufferhold its own mutex for the whole call, so the padding state and the wire order change together. Mux writes were already serialized by theBufferedWriterlock, so throughput stays the same. On plain TCP Vision only one goroutine writes, so the lock is never contended. The same change covers the VLESS reverse portal with Vision, wheremux.ClientWorkerwrites from one goroutine per session.TestVisionWriterConcurrentWriteswrites to oneVisionWriterfrom two goroutines while the underlying writer holds the first write until the second one lands. Without the lock the second block goes out first without the user UUID, and aVisionReaderon the other side returns padding bytes as payload. The test is deterministic: it fails onmainwithout the change and passes with it, with-raceas well.The repro from the issue (100 UDP associations at once through Vision + XUDP):
-race)go test -race ./proxy/ ./common/mux/... ./proxy/vless/...passes.