github-vet / github-vet/rangeloop-pointer-findings

cockroachdb/cockroach: pkg/storage/pebble_merge.go; 16 LoC

Open
#11,371 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [cockroachdb/cockroach](https://www.github.com/cockroachdb/cockroach) at [pkg/storage/pebble_merge.go](https://github.com/cockroachdb/cockroach/blob/4e3a9ccdb9cac89ae32d6248bb9b119b5bc250f7/pkg/storage/pebble_merge.go#L293-L308)

Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first
issue it finds, so please do not limit your consideration to the contents of the below message.

> function call which takes a reference to timeSeriesOp at line 307 may start a goroutine

[Click here to see the code in its original context.](https://github.com/cockroachdb/cockroach/blob/4e3a9ccdb9cac89ae32d6248bb9b119b5bc250f7/pkg/storage/pebble_merge.go#L293-L308)

Click here to show the 16 line(s) of Go which triggered the analyzer.

```go
for _, timeSeriesOp := range t.timeSeriesOps {
if timeSeriesOp.StartTimestampNanos != merged.StartTimestampNanos {
return nil, nil, errors.Errorf("start timestamp mismatch")
}
if timeSeriesOp.SampleDurationNanos != merged.SampleDurationNanos {
return nil, nil, errors.Errorf("sample duration mismatch")
}
if !isColumnar && len(timeSeriesOp.Offset) > 0 {
ensureColumnar(&merged)
ensureColumnar(&timeSeriesOp)
isColumnar = true
} else if isColumnar {
ensureColumnar(&timeSeriesOp)
}
proto.Merge(&merged, &timeSeriesOp)
}

```

Click here to show extra information the analyzer produced.

```
The following graphviz dot graph describes paths through the callgraph that could lead to a function calling a goroutine:
digraph G {
"(NewServer, 2)" -> {"(RegisterSignalHandler, 1)";"(Start, 3)";"(ServeHTTP, 2)";}
"(Stage, 6)" -> {"(execCmd, 3)";}
"(Merge, 2)" -> {"(New, 1)";}
"(newSklImpl, 1)" -> {"(clear, 1)";}
"(ServeHTTP, 2)" -> {"(getSession, 2)";}
"(QueryRowEx, 6)" -> {"(QueryEx, 6)";}
"(Start, 2)" -> {"(run, 3)";}
"(run, 3)" -> {"(MarkVerified, 3)";"(getBalance, 4)";"(getSession, 3)";"(setupTPCC, 4)";"(Release, 3)";}
"(setupTPCC, 4)" -> {"(Stage, 6)";}
"(runHistoryWithRetry, 4)" -> {"(runHistory, 4)";}
"(runHistory, 4)" -> {}
"(getBalance, 4)" -> {"(Query, 2)";}
"(verifySession, 2)" -> {"(QueryRowEx, 6)";}
"(initConnEx, 5)" -> {}
"(Release, 3)" -> {"(QueryEx, 6)";}
"(RegisterSignalHandler, 1)" -> {}
"(bgExec, 1)" -> {}
"(RunLimitedAsyncTask, 5)" -> {}
"(execCmdEx, 3)" -> {}
"(queryInternal, 6)" -> {"(execInternal, 6)";}
"(execInternal, 6)" -> {"(initConnEx, 5)";}
"(MarkVerified, 3)" -> {"(QueryEx, 6)";}
"(New, 1)" -> {"(newTreeImpl, 1)";"(newSklImpl, 1)";"(NewServer, 2)";}
"(run, 2)" -> {"(runHistoryWithRetry, 4)";}
"(clear, 1)" -> {"(Delete, 2)";}
"(Start, 3)" -> {"(Start, 2)";"(run, 2)";}
"(Delete, 2)" -> {"(Exec, 1)";}
"(QueryEx, 6)" -> {"(queryInternal, 6)";}
"(getSession, 3)" -> {"(Query, 2)";}
"(execCmd, 3)" -> {"(execCmdEx, 3)";}
"(getSession, 2)" -> {"(verifySession, 2)";}
"(newTreeImpl, 1)" -> {"(clear, 1)";}
"(Exec, 1)" -> {"(bgExec, 1)";}
"(Query, 2)" -> {"(RunLimitedAsyncTask, 5)";}
}

```

Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.

commit ID: 4e3a9ccdb9cac89ae32d6248bb9b119b5bc250f7

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.