When a timeout happens during thumbnail generation, the image.Paletted leaks, since the Goroutine has no way of terminating. My working hypothesis is that when the does not connect, the pipewriter is stuck and thus never completes. The solution would be to simply write the result to a channel. Since I plan to give some parts a bit of a make-over after the current misc-fixes PR, I can take a look at it afterwards.
pr, pw := io.Pipe()
go func(pw *io.PipeWriter, p *image.Paletted) {
// we are stuck in this call
err = u.Encode(ctx, pw, p)
if err != nil {
_ = pw.CloseWithError(errors.New("gif: error encoding still frame thumbnail: " + err.Error()))
} else {
_ = pw.Close()
}
}(pw, targetImg)
When a timeout happens during thumbnail generation, the
image.Palettedleaks, since the Goroutine has no way of terminating. My working hypothesis is that when the does not connect, the pipewriter is stuck and thus never completes. The solution would be to simply write the result to a channel. Since I plan to give some parts a bit of a make-over after the current misc-fixes PR, I can take a look at it afterwards.