Skip to content

Memory hoarding (i.e. leak) in simpleBufferPool #8500

@mchandler-plato

Description

@mchandler-plato

What version of gRPC are you using?

  • google.golang.org/grpc v1.73.0
  • google.golang.org/protobuf v1.36.6

What version of Go are you using (go version)?

  • go version go1.24.4 linux/amd64

What operating system (Linux, Windows, …) and version?

  • linux

What did you do?

Returning grpc unary response objects that are ever increasing in sizes causes the simple buffer pool to keep allocating buffers and never free old ones. (see attached test)

What did you expect to see?

  • simple buffer pool free's buffers if it has too many pending buffers
  • simple buffer pool allocates buffers rounding up size to nearest 512 bytes to encourage re-use
  • option to use NopBufferPool instead of simpleBufferPool once exceeding tiered pool size

What did you see instead?

GC thrashing and eventual oom

Test that causes the bad behavior

https://gist.github.com/mchandler-plato/61fb18e770a9a9db78ddd6a14a88c13a

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions