Repository navigation
Conversation
|
Possible race here: Maybe check |
|
@Fangliding fixes #7100 吗 |
|
c.close 应该只在 StatusInactive 状态调用,还有一些小地方我需要改下 |
|
。。怎么又有提交,别这样搞,有点打架了 |
|
|
|
Is 9897b5a a rough draft? |
可以是最终版,instance 是会被读两次,不是很想在 status 里去区分这个,因为和 quic 无关 |
|
This is based on reading 9897b5a, without a runtime reproduction. I mean two specific interleavings.
With the double read, the issue isn’t the number of checks itself: |
应该没有人在hysteria用mux cool吧 可以不考虑以后再说 |
|
看了一下上面感觉可能close语义略显混乱(我自己写的时候也发现了)因为以前没考虑要移除 |
|
主要加入 remove 逻辑后就得确保主 manager remove 后后面的 tcp udp 不会再新建 quicConn,我先修下死锁 |
|
我知道,是因为我后面加的,这部分是可以独立出来的,不用动 status |
|
Awesome!
|
|
For MUX, @Fangliding @LjhAUMEM ?
type DialingWorkerFactory struct {
+ Ctx context.Context
Proxy proxy.Outbound
Dialer internet.Dialer
Strategy ClientStrategy
}
func (f *DialingWorkerFactory) Create() (*ClientWorker, error) {
+ baseCtx := f.Ctx
+ if baseCtx == nil {
+ baseCtx = context.Background()
+ }
+
@@
- ctx := session.ContextWithOutbounds(context.Background(), outbounds)
+ ctx := session.ContextWithOutbounds(baseCtx, outbounds)
Factory: &mux.DialingWorkerFactory{
+ Ctx: core.ToBackgroundDetachedContext(ctx),
Proxy: proxyHandler,
Dialer: h,This keeps the instance without inheriting request cancellation or other request values. |
The port of XTLS#7107 held the pool read lock while the cleaner called Instance.IsRunning, which now waits for statusLock held by Start and Close for the whole feature lifecycle, and while it waited for a client lock held by a dial during its handshake. Either wait blocked every dial to a new destination, and then, behind that waiting writer, every Hysteria dial in the process. A feature whose Close waits for an outbound dial (app/geodata waits for its cron download, which can use a Hysteria outbound) and the cleaner then waited on each other. cleanOnce now snapshots the pool under the read lock and checks and cleans each client without it. A forced client is still closed before it is removed, and it is removed only if the pool still holds that pointer, so overlapping passes keep a replacement a dial added under the same key. This deviates from upstream XTLS#7107 (2b0d898) and is recorded in docs/FORK.md. Regression tests, each failing on the previous cleanOnce: - TestCleanerWaitingForInstanceStatusDoesNotBlockDials - TestCleanerWaitingForOneClientDoesNotBlockOthers/new_client - TestConcurrentCleanersKeepReplacementClients (also fails with a snapshot that deletes without the identity check)
Port of XTLS#7107 at 2b0d898, which fixes XTLS#7100. The Hysteria client pool is process-wide, so an application that restarts Xray in one process kept one QUIC connection per stopped instance open, sending keepalives, until the process exited. A client now keeps the instance from the context of its first dial. The cleaner closes the clients of an instance that no longer runs, removes them from the pool and marks them, so that a dial already holding such a client fails instead of opening a connection no pool owns. Instance.IsRunning takes the status lock, and AddFeature uses it. Differences from the upstream head: the switch of OmitMaxDatagramFrameSize from the 2026-09-01 date check to true is left out, because it is unrelated and changes the QUIC transport parameters of a client whose clock is before that date. The cleaner pass is clientManager.cleanOnce and the pool lookup is clientManager.dial, so tests drive one pass on a private pool; a nil-by-default cleaning hook lets a test see the cleaner reach a client. Not covered: Mux.Cool builds worker contexts from context.Background(), so its clients have no instance and are never forced. A dial from a stopped instance after its client was removed creates a new client that the next pass closes. svlavr found the races and deadlocks of the intermediate upstream versions. The later upstream commits are authored "null <null>"; the PR discussion suggests LjhAUMEM wrote them. Co-authored-by: Fangliding <[email protected]>
Sync the fork with upstream 7da5dae..v26.10.10 (13 commits). Conflict resolutions: - Routing and DNS Lua scripts (XTLS#6823): take them. The dispatcher picks routes through the fork's PickRouteTag, which bypassed the script hook upstream placed in PickRoute; PickRouteTag now runs the script too, and NeedsSniffingAttributes reports true while a script is loaded because a script can read attributes. Covered by script_fastpath_test.go and by upstream's TestRouterScriptDNSDispatcherReentry, which failed without it. - Logging: the Lua log module calls the fork's ShouldLog instead of upstream's GetSeverity; its tests save and restore the fork's handler snapshot and filter through Enabled. - Dispatcher: keep the ShouldLog guard and add upstream's error log for a failed route pick. - XDNS (XTLS#7095): take upstream's synchronous upload and its fragment manager without the per-client size counter. The fork's full-queue test becomes a test that every written packet reaches a resolver; the fragment-manager test checks entries only. - Hysteria (XTLS#7107): keep the fork's pool cleaner (docs/FORK.md); take only OmitMaxDatagramFrameSize: true, which the old date check already gave. - TLS client: keep session resumption in copyConfig and add upstream's GetClientCertificate bridge for MASQUE WARP. - go.mod: add gopher-lua (MIT), gopher-luar (MPL-2.0) and x509roots/fallback; keep golang.org/x/text v0.43.0. - Version stamp stays 26.10.6-2241 until the next fork release.
Upstream merged XTLS#7107 in v26.10.10; the Hysteria bullet now names that commit. Two new bullets cover the routing script on the dispatcher's PickRouteTag path and the XDNS WriteTo that sends without the client mutex, each with the tests that guard it.

在instance 关闭后正确回收连接
#7102 (comment)