confd icon indicating copy to clipboard operation
confd copied to clipboard

Memory leaks

Open huwenzheng opened this issue 8 years ago • 7 comments

I run for a month, I find it memory is 4.9 G, hope the author can help to look at, thank you!

huwenzheng avatar Apr 01 '17 01:04 huwenzheng

Which backend do you use?

On Sat, Apr 1, 2017, 03:21 huwenzheng [email protected] wrote:

I run for a month, I find it memory is 4.9 G, hope the author can help to look at, thank you!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kelseyhightower/confd/issues/550, or mute the thread https://github.com/notifications/unsubscribe-auth/AQFc8zOiFCEMqz6w13XjBUR8_igTMOToks5rraaagaJpZM4MwTeB .

HeavyHorst avatar Apr 01 '17 06:04 HeavyHorst

zookeeper watch model

huwenzheng avatar Apr 01 '17 06:04 huwenzheng

Hmm. How did you measured confds memory usage? Top is not reporting the accurate memory usage of your application for example.

On Sat, Apr 1, 2017, 08:47 huwenzheng [email protected] wrote:

zookeeper watch model

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/kelseyhightower/confd/issues/550#issuecomment-290900652, or mute the thread https://github.com/notifications/unsubscribe-auth/AQFc8-T0o_1hnJZBsgTgrDooVFABrv2mks5rrfLpgaJpZM4MwTeB .

HeavyHorst avatar Apr 01 '17 06:04 HeavyHorst

"top | grep confd" the confd memory is 4.9G 。when i restart it , it ok

huwenzheng avatar Apr 01 '17 07:04 huwenzheng

and sometimes the cpu is very hight (300% ~ 500%), i don't fond sleep function in "for" loop and not have runtime.GC() function.

huwenzheng avatar Apr 01 '17 07:04 huwenzheng

There maybe some problems in the implementations:

https://github.com/kelseyhightower/confd/blob/master/backends/zookeeper/client.go#L99

This may lead to a goroutine leak: when multiple keys are changed in a WaitPrefix call, more than one goroutines may try to write to the response channel, but the calling routine only receives one of them, leaving others to be blocked indefinitely.

Another problem may be

https://github.com/kelseyhightower/confd/blob/93c8904baa404add44565be4e42716eb391f83f9/backends/zookeeper/client.go#L86

Watches are set for every key in every loop, but most of them are not triggered. This may leave a lot of channels open.

And there are also other problems like changes are missing. I don't know how to fix all of these...

hubo1016 avatar Apr 23 '18 03:04 hubo1016

We have an intensive CPU usage too using confd with ZooKeeper. More or less 5 processes are using near 100% of CPU until we restart the service.

Version:

confd 0.16.0 (Git SHA: 7217b0c, Go Version: go1.12)

jouir avatar Jun 05 '19 09:06 jouir