-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change default chunk payload string length #1039
Conversation
api/auth/signer/v4/chunked_reader.go
Outdated
@@ -37,7 +40,7 @@ var ( | |||
// The chunkedReader returns io.EOF when the final 0-length chunk is read. | |||
func NewChunkedReader(r io.ReadCloser, streamSigner *ChunkSigner) io.ReadCloser { | |||
return &chunkedReader{ | |||
r: bufio.NewReader(r), | |||
r: bufio.NewReaderSize(r, MaxChunkedPayloadLineLength), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's a fix. I can always create something that is larger than this limit and make the gateway panic which is unacceptable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure too, but we would try
api/auth/signer/v4/chunked_reader.go
Outdated
@@ -199,7 +202,7 @@ func readChunkLine(b *bufio.Reader) ([]byte, []byte, error) { | |||
} | |||
return nil, nil, err | |||
} | |||
if len(p) >= maxLineLength { | |||
if len(p) >= MaxChunkedPayloadLineLength { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here it's too late, panic happens earlier than that. The real question is why ReadSlice
doesn't return ErrBufferFull
above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving these rows upper is not a solution either, because panic inside bufio.ReadSlice
and we just don't have the opportunity to check the length
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, but we also need to know why it panics. It shouldn't.
Can be related to multithreading in fact. Why does it happen in a separate routine? You can use https://pkg.go.dev/io#TeeReader instead of |
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
327cf91
to
19fb4cc
Compare
I don't think this fix will change the situation, but it looks better. Maybe this panic is connected to golang/go#22330 |
Closes #1032.
We should try it out