-
Notifications
You must be signed in to change notification settings - Fork 128
Fix for keep-alive memory leak #29
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
base: trying_to_fix_memory_leak
Are you sure you want to change the base?
Fix for keep-alive memory leak #29
Conversation
Do you have any results using Wrk? Every time I make a gain in Wrk I lose in HttpPerf and when I fix HttpPerf I lose in Wrk work loads. Could you please give it a run with Wrk? and post Valgrind results? :) |
tl;dr I think the source of memory leaks is caused by the server being prematurely killed before the pending responses have a chance to finish and cleanup. To answer your question, the above valgrind results are from my previous tests using However, I was able to replicate your memory leaks after I varied the order of tests in the same way that you did. I started the server and ran the following tests:
Here are the valgrind results:
When investigating the source of the largest leak, Here is the sample output I added to
Whenever My hypothesis is that valgrind memory leaks are a result of the server being killed immediately after the tests have finished, even though the server is still active processing requests. Whenever both counters reach 0, then the server is idle and all memory has been deallocated; the server can be killed, and valgrind will be much happier. I've included a diff of the debug statements I used in
With the debug statements, I ran the tests numerous times and in different orders. After waiting for both counters to reach 0, I was consistently able to get clean valgrind results. I hope you will be able to see similar results. |
@kellabyte @jbcrail is this still happening with master? |
Building upon your work in
http_request_on_header_field()
, I refactored the code that set and deleted a request header into separate functions. I changed the body ofhttp_request_on_header_field()
andhttp_request_on_header_value()
to be the same.I ran the following tests:
The result from valgrind was much better: