etcd-io / etcd

Distributed reliable key-value store for the most critical data of a distributed system
https://etcd.io
Apache License 2.0
46.78k stars 9.64k forks source link

Memory leak #18085

Open TheRealMal opened 1 month ago

TheRealMal commented 1 month ago

Bug report criteria

What happened?

file is being opened here https://github.com/etcd-io/etcd/blob/9914047acb5c679531f644d9c81718fcd85a3108/client/v3/snapshot/v3_snapshot.go#L63

but being closed only here https://github.com/etcd-io/etcd/blob/9914047acb5c679531f644d9c81718fcd85a3108/client/v3/snapshot/v3_snapshot.go#L87

Between these lines errors can be occured and file won't be closed

What did you expect to happen?

There should close function invocation via defer

How can we reproduce it (as minimally and precisely as possible)?

Check code

Anything else we need to know?

-

Etcd version (please run commands below)

latest

Etcd configuration (command line flags or environment variables)

-

Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)

-

Relevant log output

-
ahrtr commented 1 month ago

Thanks for raising this. Please feel free to deliver a PR, thx

vivekpatani commented 1 week ago

@ahrtr @TheRealMal https://github.com/etcd-io/etcd/pull/18200 - does this make sense?