-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Sniffer: Fix potential infinite loop #4726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
97d089e
to
64ab125
Compare
这个所谓bug崩溃你真的自己触发过吗 你这么改也很大问题 |
Read carefully what I said. It doesn't matter that cacheErr cannot be nil, if cacheErr != buf.ErrReadTimeout(cacheDeadline not exceed) it stuck in infinite-loop. cc@RPRX |
Please reopen. |
改成我说的那样应该就行了 你这么改肯定不对 |
No, it is not enough. suppose we received some data and payload is not empty and sniffer is in this code: Xray-core/app/dispatcher/default.go Line 42 in 72170d8
shows that it is possible that |
那就是我最前面说的情况了 cReader.Cache() 要么就是成功read了一次 要么失败 不可能返回相同的buf的 |
so, i have two question:
|
anyway, if we add:
to your code, your code is also ok. /// also, |
它会被无视
这段代码已经8年了 也许曾经的机制不是这样 所以我觉得需要真的测出有BUG再去动 没事不要乱改
因为这会导致一些无法识别的流量使sniffer持续尝试直到超时 比如telegram 等于凭空增加200毫秒延迟 这对很多人都是无法接受的 |
if and if possible -> it prevents infinite-loop. --> it is better to add. ///
|
and what about second one? can you tell me what exactly should I'm sure and I tested, there's no difference from |
we increase
It's very rare that we have another protocol that matches part of tls/http/quic protocol, so we can safety increase |
返回NoClue的地方非常多而且以后也可能加新的嗅探器 它的作用仅仅只是与完全不匹配区分并在下一次嗅探不再重复应用嗅探器 不应该期望它全部为ErrNoClue作出什么行为 而且我还是那句话 它真的会无限循环吗? 你有日志辅助证明吗? 你在loop里打个日志输出看到它真的loop了很多次都行 没有的话我觉得就算了 这是最后回复了 没有的话懒得跟你接你话了 |
reproduction:
that is (hexStream): "37653661343330396464663665383836363637396636316163653466363231623065333435356562616332653833316136306631336364310d0a01010808080801bb0d0a" decrypt-password for use in Xray-core trojan-inbound config: "12345678"
then you see Thousands of loops in Xray-core log !!! /// after reading the code i see that you use so i revert /// please reopen again, this is why Xray-core was crashing randomly when where are you? This is one of the biggest bugs discovered and you haven't commented yet? |
有复现就好说很多了 虽然这和panic没关系 会多吃cpu而已 但是我还是觉得改两行就够了 没必要parse具体的read err更别动totalAttempt 如果你还是觉得有问题可以提供新的proof |
Why should we run some redundant loop when my plan is to fix but with your code we will run 31 redundant loop, please revert, thx. |
I'm still waiting for your answer for |
好的 |
my PRs is important too, after fixing about 20 small and big bugs, I wonder why you still don't trust me. anyway, even @Fangliding reviewed my PRs and found no problem. |
瞎鸡巴乱改的是不是傻逼 |
啊 这样会炸吗 |
|
Anyway v25.5.16 先这样吧,如果引入新的 bug 了你们才会知道为什么我不倾向于在发重要版本前合并些未经验证的 PR |
麻了,重新发版后 GitHub Action 的 check-assets 炸了 https://github.com/XTLS/Xray-core/actions/runs/15068312131 |
但是 https://github.com/XTLS/Xray-core/actions/runs/15068312128 的 check-assets 却不会炸,什么区别 @Meo597 @KobeArthurScofield |
疑似 GitHub 卡点炸了 |
"Event Validation Error: The event type release is not supported because it's not tied to a branch or tag ref." |
i don't understand why you release asset files too. if there is no geo-files, you can just display a message to users: "no geo files found, please download from ...". and for tests you can use fixed(outdated) geo files. |
@KobeArthurScofield 不是卡点,试了几次就这个炸,可能是新加的这个 check-assets 遇到同 tag 删了重发这种会炸? |
就很怪,要不重新 release 看看?可能是这个 release 的时候不知道出了什么问题 |
后面找不到 assets 重新下载的流程似乎也有奇怪的问题, @Meo597 有没有想法 |
|
不过应该不用 v25.5.17,既然之前把 VCS 关了,按我以前的办法开个 branch 叫 v25.5.16 然后把 release 判断取反并手动填入 commit 七位短 id 并手动触发就行,@KobeArthurScofield 你有权限试一下吗 |
没权限啊 😂 |
80ea4e0 可行,并且由于之前改成了非 main 的 push 也会触发 action,无需手动触发 |
不过你们有空时还是得看下是不是哪里写错了,导致这次这么怪 |
怪死了,我 fork 下来跑没有复现 有可能是 release 的时候 GitHub 不知道什么问题(race condition 之类的)导致最后进 Actions 的环境有问题,这种情况重跑不行,重跑只针对随机出现的问题,但是环境有问题就不好使了。
|
我看了一下日志,是github action没能获取到context.ref导致的,报的实际上是类似空指针异常 这种情况即便没有chk-assets后续也绝不可能成功 然后chk-assets的流程是: 根据action的机制,re-run是没用的,因为这些信息是在任务创建的时候装入的 |
然后我试了几次,复现不了。 |
@RPRX 我刚才又仔细地测了一下 Build and Release #4204: Release v25.5.16 published by RPRX 这种 我倾向于是github内部bug 然后我看了文档,action的cache是分支间不共享,除非继承 想要避免这种问题解决办法就是写防御性代码 然后在后面的buid步骤恢复缓存必定失败,直接curl下载geodat 来回测了七八次,只发现workflow中原先等待90s有时候不够,github调度任务有时延迟较大 |
|
during reading sniffer code, i found two bugs and fixed them:
1. infinite-loop bug:
Xray-core/app/dispatcher/default.go
Line 376 in 72170d8
if
cacheErr != buf.ErrReadTimeout
(cacheDeadline not exceed) andpayload.IsEmpty()
, The code gets stuck in infinite loop, and CPU usage reaches 100%, and the app crashes !(also if
cacheErr == nil
andpayload
doesn't change andErrProtoNeedMoreData
, the same thing happens)This bug is probably the main reason for #3914.
2. fakedns+others:
After reviewing the code, I realized that
"destOverride": ["fakedns+others"]
is no different from"destOverride": ["fakedns"]
, That means"destOverride": ["fakedns+others"]
behaves exactly like"destOverride": ["fakedns"]
.I also tested this to make sure.