Closed omriarad closed 7 months ago
Thanks for the clear bug report! I've made it so that if the NewRangeReader
inside Read
(sometimes called after a Seek
) fails, it leaves the Reader
in the same state it was before the error is returned.
Great! Thanks for the quick response, much appreciated!
Describe the bug
Panic caused by nil pointer dereference in blob Reader after error in
Read
. Debugging this it seems this is caused byReader
entering an invalid state:Read
is called and we reach line 147 (in version0.37.0
) andNewRangeReader
returns an error:nil
.Seek
(which doesn't validate the object) is later called for the reader, we reachSize
andr.r.Attributes().Size
panics.To Reproduce
Managed to reproduce this 100% of the time in a nonsensical way with context canceling:
Traceback:
Expected behavior
Expected an error and not to panic.
Version
gocloud 0.37.0
Additional context
The original program consists of a lot of goroutines working on the reader with locks, the use itself is not ideal but at the very least it probably shouldn't crash. I would expect that if one gorountines errors (say from timeout getting context deadline exceeded) another goroutine using it would also get an error and not panic.