mozillazg / go-cos

腾讯云对象存储服务 COS(Cloud Object Storage) Go SDK(XML API)
https://godoc.org/github.com/mozillazg/go-cos
MIT License
88 stars 26 forks source link

not close body seems lead to leak #23

Closed hanjm closed 3 years ago

hanjm commented 3 years ago

https://github.com/thanos-io/thanos use this lib. the thanos tools bucket web run after some duration, there will a lot of error logs like dial tcp 169.xxx:443: connect: cannot assign requested address

image

I foud that the GET method not close body, may be relevant?

https://github.com/mozillazg/go-cos/blob/master/cos.go#L241

mozillazg commented 3 years ago

@hanjm The Object.Get method does not auto-close the body that is expected, because the caller will read data from the body later. So, the caller should close the body by themself when call the Object.Get method like the examples in README and _example/ .

hanjm commented 3 years ago

@mozillazg I see, thank you.