-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Description
Bug Description
2024-08-08T19:10:15.458367Z:PgListenerreturnsError::Protocol(msg).- 1s later, our app's memory usage jumps from 0.033 GB to 1.32 GB according to netdata.
- Memory remains at this level until the next time we receive
Error::Protocolat which point it jumps again. Every occurrence seems to produce a memory increase of ~1.2 GB. This repeats on each Protocol error until OOM kill.
This is the protocol error msg:
unknown message type: '\\0'
I captured this memory flamegraph with heaptrack:
This implies that all of the 1.2GB of memory is being allocated by the PgConnection and not released. When we encounter a protocol error, we drop the PgListener instance and create a new one. Perhaps the Drop implementation of PgListener is failing to cleanup as the PgListener is in some sort of invalid state due to the protocol error?
Minimal Reproduction
Due to the protocol error, unable to reproduce minimally.
Info
- SQLx version: v0.7.4
- SQLx features enabled: [
"chrono",
"postgres",
"runtime-tokio",
"time",
"tls-rustls",
"bigdecimal",
] - Database server and version: Postgres 16.3 (with Timescale plugin)
- Operating system: 22.04.1-Ubuntu
rustc --version: rustc 1.76.0 (07dca489a 2024-02-04)
Reactions are currently unavailable
