Skip to content

Commit

Permalink
Hotfix to solve a backup stream limit Issue (#816)
Browse files Browse the repository at this point in the history
* Adding maxHeaderSize const and changing the appendBlock validation to considerate header size
  • Loading branch information
eric-gmendes committed Nov 17, 2022
1 parent cc3159b commit 44c2ab3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/system_service.go
Expand Up @@ -224,6 +224,7 @@ func (s *systemService) Export(req *proto.ExportRequest, stream proto.System_Exp

const (
defaultMaxGRPCPayloadSize uint64 = 512 * 1024 // 4MB
maxHeaderInfoSize int = 3 * 8 //Number of header fields * bytes per field (From, To, Latest all them uint64)
)

type blockStreamWriter struct {
Expand All @@ -250,8 +251,7 @@ func newBlockStreamWriter(

func (w *blockStreamWriter) appendBlock(b *types.Block) error {
data := b.MarshalRLP()

if uint64(w.buf.Len()+len(data)) >= w.maxPayload {
if uint64(maxHeaderInfoSize+w.buf.Len()+len(data)) >= w.maxPayload {
// send buffered data to client first
if err := w.flush(); err != nil {
return err
Expand Down

0 comments on commit 44c2ab3

Please sign in to comment.