-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Memory leak #3221
Comments
heap.zip |
@er888kh |
same problem , in my experience , version 1.8.4 is fine , and after that version , xray will leak |
麻烦逐个测试 v1.8.4 至 v1.8.6 之间的 commits,看一下哪个 commit 出现该问题 @er888kh 你那边也是这样吗? |
From this pprof, the biggest is at readv reader with 220MB. Although I'm not sure if this is indeed a leak. Can you profile a bigger usage? (Or reduce the buffer size to isolate the issue) |
Same issue on MT7981A (ARM64, cortex A53) with 512MB RAM, have try 1.8.4 and 1.8.10, both consume all RAM on device after first speedtest running and hangs, switch to sing-box 1.8.10 without change anything on server side (xray-core 1.8.10) and have no issues with memory consumption (~180 MB RAM after 10 and more tests). P.S. |
Same problem when running speedtest with chain-proxy config and using Xray-Core |
Same problem |
there is similar report's in marzban |
@M03ED just in case what I was facing was not OOM issue. I couldn't find any reason for the issue. but with another configuration (WS+VMESS) I have about 5k sockstat TCP metrics and there are no issues with connections. |
I think this issue has become about too many things at once (socket/filedescriptor leak versus memory leak) and each of the reports is not very specific. I suggest to attempt these things:
|
i checked original v2ray repository and found same bug I used the patch from the bug and it seems to have helped with the big leak, at least the process doesn't eat memory as aggressively. tested on 1.8.23 release code place to patch Xray-core/transport/pipe/impl.go Line 92 in 41d03d1
applied patch
|
@boris768 Then it seems the real issue might be that some pipe is not correctly closed somewhere, or generally resources are not cleaned up in some inbound/outbound or transport. Unfortunately this patch has the ability to work around a variety of different issues, it doesn't really explain what's going on IMO |
@mmmray, i testing this patch, that can be used as hack way to fix memory leak. I using simple XTLS-Reality setup and without fix 8-10 clients gives xray memory usage up to 700-800 mb in one day (OOM kills service). With fix, memory peak usage reaches 150mb. |
…S/Xray-core#3221)" This reverts commit ada9528.
Is the problem solved ? |
Not completed, but it's missing too much information (for example, what version was it introduced?), nobody has investigated it much, and it's not clear if this is 1 issue or N issues. As a developer I also wouldn't know what to do with it right now. I guess, let's reopen when somebody has managed to make another heap profile or some other discovery. I think the patch cannot help like this, to be honest. |
There is / has been a memory leak issue since at least version 1.8.9. I have tested the latest release, and it is leaking at a rate of about 1.7 GB for every 100 GB of traffic proxied, during a time frame of 24 hours and with 50 active users. I have not done experiments to correlate these numbers with each other, but it seems like the amount of leaked memory is proportional to the served traffic. There is also no ceiling to this, it just grows until
systemd-oomd
kills it. I have tried usingvless only
,vless+vmess
andvless+trojan
, and avoided the newly added transports but to no avail. I would be more than happy to experiment more and provide the team with more information. I am runningxray
behindhaproxy
and that behind cloudflare CDN.OS:
Ubuntu 22.04
, all packages up-to-date.Architecture:
Armv8
, Neoverse-N1 at Hetzner. Also genericx86
platforms.Memory: 4GB
Kernel:
Generic Ubuntu 5.15.0-xxx
Logging: Disabled
The text was updated successfully, but these errors were encountered: