ChainSafe / ChainSafe/gossamer

Use `*bytes.Buffer` instead of `*[]byte` in `dot/network` buffer pool to accommodate larger messages

Open
#2,288 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
454
Forks
144
PR merge metrics
No merged PRs in 30d

Description

## Task summary

This shows in the warnings logs when syncing:

```
received message with size 75041 greater than allocated message buffer size 64512
```

This comes from https://github.com/ChainSafe/gossamer/blob/3ae34011ee4d00bc0c439d21e93c121ba7701294/dot/network/utils.go#L198

and it looks like we drop the message. I'm not sure of the implications but we might want to use `*bytes.Buffer` in our sync.Pool which dynamically will resize, instead of using fixed sized `*[]byte`.

Contributor guide

Open the contributing guide

Research direction

Read dot/network/utils.go around line 198 and trace the sync.Pool used for message buffers. Confirm how the fixed *[]byte size causes the warning and message drop, then verify that the buffer-pool change accommodates messages larger than the current allocation without that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.