-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix the memory leak on the wait API #1862
fix the memory leak on the wait API #1862
Conversation
Test is broken. I'll look into it. |
The pollForIndex method starts a goroutine to check the latest index periodically. But when the HTTP request finishs, the loop is still there and the goroutine never exits. This leads to a memory leak and goroutine leak after each request to the "/wait/:index" API. The problem can be reproduced by ```ab -c 10 -t 30 http://127.0.0.1:8086/wait/1```. After several times of benchmark you'll find that the memory usage grows markedly. Signed-off-by: Shijiang Wei <mountkin@gmail.com>
300a32e
to
6d5ca0e
Compare
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
This change generally makes sense to me -- thanks @mountkin . However, can you move the new type and methods to nearer the top of the file, where is it isn't simply in the middle of other |
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Hi @otoolep |
@mountkin very clean approach. I like it a lot. |
@mountkin can you sign the CLA here http://influxdb.com/community/cla.html and then we can merge. |
@corylanou CLA signed |
fix the memory leak on the wait API
The pollForIndex method starts a goroutine to check the latest index
periodically. But when the HTTP request finishs, the loop is still there
and the goroutine never exits.
This leads to a memory leak and goroutine leak after each request to the
"/wait/:index" API.
The problem can be reproduced by
ab -c 10 -t 30 http://127.0.0.1:8086/wait/1
.After several times of benchmark you'll find that the memory usage grows markedly.
Signed-off-by: Shijiang Wei mountkin@gmail.com