Repository navigation
XHTTP: stream replayable HTTP/2 packets and release retired connections - #7572
Closed
wywywywycloud wants to merge 1 commit into
Closed
wywywywycloud wants to merge 1 commit into
wywywywycloud wants to merge 1 commit into
Conversation
This was referenced Dec 5, 2026
Share immutable buffers across independent request readers and bound DATA reads without lowering the POST size. Close idle HTTP/2 connections after the last response body and any pending uploads have finished.
wywywywycloud
force-pushed
the
fix/xhttp-h2-packet-body
branch
from
December 5, 2026 00:41
b023a3f to
3bc0585
Compare
Member
|
暂时不打算对h2做单独retry 连h1上都有点麻烦了 一般来看mux在h2里不太容易失败 |
5 tasks done
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.
Related to #7568. This change targets HTTP/2 body uploads and connection retirement. It applies directly to
919d0aeand does not include #7569 or #7571.Changes
Verification
OpenWrt 25.12.5 amd64 VM, two vCPUs, 256 MiB RAM, no swap,
GOMEMLIMIT=28MiB,GOGC=30. The server was unmodified Xray v26.11.9. Each round uploaded 32 MiB plus 23 bytes times the stream index per VLESS/XHTTP packet-up stream. The receiver sent back the SHA-256 of each stream. Rounds ran in one client process with five-second pauses. Memory figures are sampled RssAnon, not total system memory.919d0aeBoth 16-stream runs created six XMUX clients and retired three. The 32-stream baseline hit the 60 MiB available-memory guard in round one. This PR alone still came close to that guard (61.52 MiB minimum available). #7571 addresses the separate queue cost. These runs had no artificial RAM reservation.
Both retirement tests failed against main with the baseline HTTP version set to 2. They passed on this branch. For a 1,000,000-byte payload,
BenchmarkPacketBodyreported 1,028,331 B/op for the copy and 11,334 B/op for shared readers (100 iterations). This is an allocation benchmark, not a network speedup.The splithttp package passed three times. Targeted tests passed ten times under the race detector, including replay after redirects, partial reads, concurrent close and retirement. Linux arm64 cross-build passed.
Combined low-memory check
The three single-commit branches (
769b2fe,3bc0585,889c083) merged cleanly into tree80efcd74215b16ccbac413eb811f75eb90a7b53c. With 90 MiB reserved in tmpfs and a 12 MiB available-memory stop threshold, each protocol ran six rounds of 32 concurrent streams without restarting the client between rounds.A separate three-round HTTP/1.1 over TLS run passed 96/96 checks, with a 27.77 MiB peak RssAnon and 16.88 MiB minimum available. No run hit the guard, logged failed uploads or reported a server queue overflow. These are synthetic VM results. Physical ARM64 hardware was not tested.
Without the reservation the combined build passed another 192/192 HTTP/2 checks. Peak RssAnon was 27.71 MiB and minimum available memory was 78.62 MiB.
Single-stream check
For one 64 MiB HTTP/2 upload without a RAM reservation, transfer times were 3.35, 2.12 and 2.09 seconds on main and 2.25, 2.10 and 2.25 seconds with all three changes. All six digests matched. The combined median was about 6% slower in this small sample.
Codex + Astra 6.2 was used for debbugging and assisted writing the code. The chat will not be included.