influxdata / influxdata/influxdb1-client

huge memory leak in ChunkedResponse

Open
#73 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
192
Forks
109
PR merge metrics
No merged PRs in 30d

Description

Reproduce: run a memory profiler with the following test case

```
func Test_ChunkedResponse_Leak(t *testing.T) {
genValues := func(n int) [][]interface{} {
var values [][]interface{}
for i := 0; i < n; i++ {
values = append(values, []interface{}{
json.Number("1716134400628000000"),
json.Number("35000.01"),
json.Number("8"),
})
}
return values
}

for i := 0; i < 100000; i++ {
resp := influx.NewChunkedResponse(bytesReader(toJson(&influx.Response{
Results: []influx.Result{
{
Series: []models.Row{
{
Columns: []string{"time", "last", "price_precision"},
Values: genValues(3000),
},
},
},
},
})))
_, err2 := resp.NextResponse()
assert.NoError(t, err2)

err := resp.Close()
assert.NoError(t, err)
}
}
```

Flame Graph:

Image

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided Test_ChunkedResponse_Leak reproducer and trace NewChunkedResponse, NextResponse, and Close while running a memory profiler. Determine which response lifecycle data remains retained after Close. Done means the reproducer no longer shows the reported leak and the relevant test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.