sql: possible memory leak in Streamer #76471
Labels
A-sql-execution
Relating to SQL execution.
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
C-investigation
Further steps needed to qualify. C-label will change.
T-sql-queries
SQL Queries Team
In each call to
NewStreamer
, we register an OnChange handler on thestreamerConcurrencyLimit
:cockroach/pkg/kv/kvclient/kvstreamer/streamer.go
Lines 338 to 340 in 2bc16c3
This handler captures the
Streamer
objects
. The handler is then never unregistered. I believe this leaks theStreamer
object and all references. This is a problem because, unlike most static objects that are leaked due to calls toSetOnChange
, we create a newStreamer
for each SQL query that uses one.Two ways to address this are to:
Streamer
. We don't currently have a way to unregister an OnChange handler, but adding one should not be difficult.Note: I haven't actually confirmed that this leaks memory, so determining whether it's real would be the first step here.
The text was updated successfully, but these errors were encountered: