Skip to content

Memory leak in Thumbnail generation #561

Description

@mpldr

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions