-
Notifications
You must be signed in to change notification settings - Fork 128
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
http2 websockets leaks while using open ssl for ping and pong #466
Comments
I might have forgotten to call some openssl cleanup function... post what you have and i can see. |
So stack looks like: Breakpoint 1 at 0x7aa0186ad640: malloc. (48 locations) Thread 16 "dmarketcalls" hit Breakpoint 1.2, 0x00007aa019038cc0 in tc_malloc () from /lib/x86_64-linux-gnu/libtcmalloc.so.4 I put also break point to free which triggers time to time but way more less than mallocs: Thread 24 "dmarketcalls" hit Breakpoint 2.2, 0x00007aa019036bc0 in tc_free () from /lib/x86_64-linux-gnu/libtcmalloc.so.4 You can see a glimbs of malloc to free ratio here. When my memory goes super high above 16gb I used https://gperftools.github.io/gperftools/heapprofile.html few times and so most of the mallocs were coming from pings. That was before I solve the issue with ping with my hack. Best Regards |
huh so it is right inside the openssl functions. i know they keep some pieces around to chunk it right but.... huh might have to check the docs again and see what im missing |
I am listening ~100 web sockets from binance.com to keep up with live transactions(every single buy and sell order).
I have been having memory leak problems for a long time and have to restart my application after 3-4 hours. Because I am running out of my 32gb ram.
Now I want to listening order book data as well(supply and demand book) but my applications just run out of memory after 5 mins.
I use many different tools to find where is leak. The best was gprefd. I found out there were too many allocations from OpenSSL and Arsd.
I used gdb and put breakpoints to malloc to confirm that and the stack trace always showed OpenSSLSocket's send and receive.
I changed the "int pingFrequency = 5000;" to a very big number and now I can run my application for 6-8 hours without running out of memory. But the memory leak still continues because I just controlled the pings that we send but also my server(binance.com) sends me pong approximately every 3 minutes. And pongs uses the same OpenSSLSocket class and its leaking functions send&recieve.
I can attach the gdb stack outputs and gpref results if it is requested.
Thanks for the awesome Arsd library, I removed all vibe.d stuff and replaced it with Arsd :)
The text was updated successfully, but these errors were encountered: