You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey @bobheadxi as I was working with release tooling which uses sourcegraph/run, I stumbled across a bufio: buffer full error.
Here is a test case to reproduce the error:
// stream_test.go
func TestPOF(t *testing.T) {
newStream := func() *streamline.Stream {
veryLongLine := "long"
for i := 0; i < 1000; i++ {
veryLongLine += "loooooooong"
}
return streamline.New(strings.NewReader(veryLongLine))
}
s := newStream()
err := s.Stream(func(line string) {
})
if err != nil {
t.Log(err.Error())
t.Fail()
}
}
While the example here is a bit exaggerated, I got the same error while streaming the response of a curl to an API that sends back JSON, so my original case is rather legitimate.
The text was updated successfully, but these errors were encountered:
This is [effectively what `(*bufio.Reader).ReadLine`
does](https://cs.opensource.google/go/go/+/refs/tags/go1.21.6:src/bufio/bufio.go;l=407-409)
- `ReadSlice` provides a partial line if its internal buffer is full, as
indicated by `bufio.ErrBufferFull`. If we get this, we're supposed to
just keep calling `ReadSlice` until we have a complete line.
Before I applied this fix, I was able to reproduce #3 with the `wide
input` test case - after this fix, the tests pass as expected.
Closes#3
Hey @bobheadxi as I was working with release tooling which uses
sourcegraph/run
, I stumbled across abufio: buffer full
error.Here is a test case to reproduce the error:
While the example here is a bit exaggerated, I got the same error while streaming the response of a curl to an API that sends back JSON, so my original case is rather legitimate.
The text was updated successfully, but these errors were encountered: