-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
internal: MediaInfo.UploadRequest possible goroutines leaking #1651
Comments
I've been trying to debug this as well. As far as I can tell, it only seems to occur when the initial request fails and thus This has been reported here as well #1380. The following script reproduces it for me:
After running, you should see one or more goroutines stuck at:
@jba is this something that you would be able to take a look at? I believe that you added the initial code for |
Hi @rntk and @kevinconaway, Thanks for filing this issue, as you mentioned we saw the issue in #1380 . As we understand it now, it's an issue with how I'm closing it here. Thank you for your patience. |
@frankyn Would you reconsider? Based on my investigation, it looks like its not necessarily that Its possible there is an issue with the implementation in |
Function UploadRequest (https://github.com/googleapis/google-api-go-client/blob/v0.13.0/internal/gensupport/media.go#L273) return function GetBody.
GetBody, by combineBodyMedia, call function newMultipartReader (https://github.com/googleapis/google-api-go-client/blob/v0.13.0/internal/gensupport/media.go#L120).
newMultipartReader use io.Pipe to create new io.Reader and create new goroutine to provide data for pipe (https://github.com/googleapis/google-api-go-client/blob/v0.13.0/internal/gensupport/media.go#L131).
From https://golang.org/pkg/io/#Pipe
If we call GetBody and do not consume data from Reader we got "forever" blocked goroutine on (https://github.com/googleapis/google-api-go-client/blob/v0.13.0/internal/gensupport/media.go#L131).
In particular, this lead to goroutines and memory leaking in storage client. In one of long running processes (about 7 days) got leaked: 62 goroutines and 496Mb of memory.
Example of debug stack trace:
go version go1.13 linux/amd64
google storage client v1.1.2
The text was updated successfully, but these errors were encountered: