Skip to content

fix: race condition of tcpConcurrent in dialer#2556

Merged
wwqgtxx merged 1 commit intoMetaCubeX:Alphafrom
chenx-dust:Alpha
Feb 5, 2026
Merged

fix: race condition of tcpConcurrent in dialer#2556
wwqgtxx merged 1 commit intoMetaCubeX:Alphafrom
chenx-dust:Alpha

Conversation

@chenx-dust
Copy link

@chenx-dust chenx-dust commented Feb 5, 2026

这个 PR 为使用 Dialer Proxy 的 Proxy 提供了一个选项 proxy-server-local-resolve,能让 server 为域名的 Proxy 能在本地解析域名。这个选项对于 Proxy 的域名解析经常变动,而 Dialer Proxy 的 DNS 缓存 TTL 无法控制的情况非常有用。代码直接复用了 dialer.go 的逻辑,尽可能减少了修改面。

同时,在浏览相关代码的时候,发现了一个可能发生的竞态条件tcpConcurrent 的调整会导致 actualXXXStackDialContext 的写入操作,这部分是受到 dialMux 保护的;但是对 actualXXXStackDialContext 的读取并没有被 dialMux 保护。这个 PR 将 tcpConcurrent 改为原子量,在避免严重影响性能的前提下修复了这个竞态问题。

Copilot AI review requested due to automatic review settings February 5, 2026 07:32

This comment was marked as spam.

@wwqgtxx wwqgtxx marked this pull request as draft February 5, 2026 07:46
@wwqgtxx
Copy link
Collaborator

wwqgtxx commented Feb 5, 2026

我们暂时不打算合并该新功能,但是您可以只保留该PR中修复race的部分并提交

@wwqgtxx
Copy link
Collaborator

wwqgtxx commented Feb 5, 2026

此外,请关闭对PR自动使用copilot的设置,否则您有可能会被block

@chenx-dust
Copy link
Author

已经进行了调整。

想问一下这个需求有没有替代方案?或者应该以什么形式实现?

@chenx-dust chenx-dust marked this pull request as ready for review February 5, 2026 07:51
@wwqgtxx wwqgtxx changed the title feat: proxy server local resolve for dialer proxy fix: race condition of tcpConcurrent in dialer Feb 5, 2026
@wwqgtxx wwqgtxx merged commit 3ac6215 into MetaCubeX:Alpha Feb 5, 2026
@wwqgtxx
Copy link
Collaborator

wwqgtxx commented Feb 5, 2026

或许未来我们会为dialer-proxy增加dialer-proxy-opts来应对可能出现的细致化行为控制,不过这些依然是草案,并没有确定是否会实施

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.

3 participants