Skip to content
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

lnrpc: increase max message size for ws proxy #7991

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

Roasbeef
Copy link
Member

In this commit, we increase the max message size for the ws proxy. We have a similar setting for the normal gRPC server which was tuned to be able to support decoding GetNetworkInfo as the channel graph got larger. We keep the default buffer size of 64 KB, but allow that to be expanded to up to 4 MB (current value) to decode larger messages.

One alternative would be to modify the Split function to break up larger lines into smaller ones. We'd need to double check that the libraries at a higher level of abstraction can handle the chunks. The scan function would look something like:

splitFunc := func(data []byte, eof bool) (int, []byte, error) {
        if len(data) >= chunkSize {
                return chunkSize, data[:chunkSize], nil
        }

        return bufio.ScanLines(data, eof))
}
scanner.Split(splitFunc)

Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@Roasbeef Roasbeef added this to the v0.17.0 milestone Sep 18, 2023
In this commit, we increase the max message size for the ws proxy. We
have a similar setting for the normal gRPC server which was tuned to be
able to support decoding `GetNetworkInfo` as the channel graph got
larger. We keep the default buffer size of 64 KB, but allow that to be
expanded to up to 4 MB (current value) to decode larger messages.

One alternative would be to modify the `Split` function to break up
larger lines into smaller ones. We'd need to double check that the
libraries at a higher level of abstraction can handle the chunks. The
scan function would look something like:
```go
splitFunc := func(data []byte, eof bool) (int, []byte, error) {
        if len(data) >= chunkSize {
                return chunkSize, data[:chunkSize], nil
        }

        return bufio.ScanLines(data, eof))
}
scanner.Split(splitFunc)
```
@Roasbeef Roasbeef merged commit 327b0c9 into lightningnetwork:master Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants