-
Notifications
You must be signed in to change notification settings - Fork 590
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
UWebsockets server keeps the allocated memory for the client as long as the client is active. #1150
Comments
Can you rerun with this commit: uNetworking/uWebSockets@42b368e std::string::erase(0, pendingRemoval) does not guarantee a shrink of capacity, so it should now be fixed |
@uNetworkingAB thank you for fast answer ! will check on sunday & get back |
There is definitely a bug (erase does not shrink the buffer) - this is fixed. However, in practice this cannot cause the bug you report because when the buffer is empty, it does clear which does shrink. So the bug is really just that it waits until the backpressure is FULLY drained before it frees rather than freeing along the drainage. |
I re-run tests with your patch @uNetworkingAB
currently is much better as far I see memory doesn't grow so much (looks like is stable) @uNetworkingAB could you release uWebSockets.js with these changes ? |
Yes next week
Den sön 19 jan. 2025 15:04igorsadovskii ***@***.***> skrev:
… I re-run tests with your patch @uNetworkingAB
<https://github.com/uNetworkingAB>
mem_usage {"rss":"0.15 Gb","heapTotal":"0 Gb","heapUsed":"0 Gb","external":"0.09 Gb","arrayBuffers":"0.09 Gb"}
--- 1'st phase: sending 100Mb to multiple clients
client received 100 Mb
mem_usage {"rss":"0.36 Gb","heapTotal":"0 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
client received 100 Mb
mem_usage {"rss":"0.44 Gb","heapTotal":"0 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
client received 100 Mb
mem_usage {"rss":"0.47 Gb","heapTotal":"0.01 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
client received 100 Mb
mem_usage {"rss":"0.47 Gb","heapTotal":"0.01 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
client received 100 Mb
mem_usage {"rss":"0.47 Gb","heapTotal":"0.01 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
client received 100 Mb
mem_usage {"rss":"0.47 Gb","heapTotal":"0.01 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
client received 100 Mb
mem_usage {"rss":"0.47 Gb","heapTotal":"0.01 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
client received 100 Mb
mem_usage {"rss":"0.47 Gb","heapTotal":"0.01 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
client received 100 Mb
mem_usage {"rss":"0.44 Gb","heapTotal":"0.01 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
client received 100 Mb
mem_usage {"rss":"0.49 Gb","heapTotal":"0.02 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
--- 2'nd phase: closing clients
mem_usage {"rss":"0.49 Gb","heapTotal":"0.02 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
mem_usage {"rss":"0.49 Gb","heapTotal":"0.02 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
mem_usage {"rss":"0.49 Gb","heapTotal":"0.02 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
mem_usage {"rss":"0.49 Gb","heapTotal":"0.02 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
mem_usage {"rss":"0.49 Gb","heapTotal":"0.02 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
mem_usage {"rss":"0.49 Gb","heapTotal":"0.02 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
mem_usage {"rss":"0.49 Gb","heapTotal":"0.02 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
mem_usage {"rss":"0.49 Gb","heapTotal":"0.02 Gb","heapUsed":"0 Gb","external":"0.29 Gb","arrayBuffers":"0.29 Gb"}
mem_usage {"rss":"0.39 Gb","heapTotal":"0 Gb","heapUsed":"0 Gb","external":"0.09 Gb","arrayBuffers":"0.09 Gb"}
mem_usage {"rss":"0.39 Gb","heapTotal":"0 Gb","heapUsed":"0 Gb","external":"0.09 Gb","arrayBuffers":"0.09 Gb"}
currently is much better as far I see memory doesn't grow so much
@uNetworkingAB <https://github.com/uNetworkingAB> could you release
uWebSockets.js with these changes ?
—
Reply to this email directly, view it on GitHub
<#1150 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2NMOMO5C42XZCDH527H2P32LOWFFAVCNFSM6AAAAABVJXDQZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBQHA3TKMJXGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Good evening,
I am facing a memory growth problem on UWebsockets server (RSS). In the example below
In the first phase
On the second phase
How to bypass this behavior so that uws server frees memory and does not keep it for as long as the client is alive (otherwise memory usage grows too high) ?
nodejs precompiled uwebsocket (require uws2) - https://www.npmjs.com/package/@luminati-io/uws2?activeTab=readme
output for the script is
script
The text was updated successfully, but these errors were encountered: