cshum / imagor

Fast, secure image processing server and Go library, using libvips
Apache License 2.0
3.46k stars 138 forks source link

Fix deadlock in fanout reader between data reading goroutine and Close #360

Closed p2004a closed 1 year ago

p2004a commented 1 year ago

When readAll tries to push data to channel it's doing it under the fanout lock which can deadlock with reader Close that also tried to acquire that lock before signaling that channel is closed.

This change resolves this by using the cancellation channel pattern.

Fixes #349