cockroachdb / cockroachdb/cockroach

sql: nil-out pointers in deallocated prepared statement

Open
#169,161 1 comment 0 reactions 0 assignees View on GitHub
C-enhancement E-quick-win O-support P-3 T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

We saw a case recently where tracing enabled on a Prisma app caused Prisma to create a new prepared statement for every issued query. As far as I can tell, this is not due to an actual memory leak. Instead, the rate of allocations simply outpaced the go GC, eventually leading to 100% CPU and OOM during high QPS periods. In the past, we've handled situations like this by nil'ing out pointers in pointer-heavy data structures before losing the reference to the structure. We should do that for prepared statement memory.

Jira issue: CRDB-63297

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.