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

elastic/beats: x-pack/metricbeat/module/oracle/tablespace/data.go; 3 LoC

Open
#9,445 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [elastic/beats](https://www.github.com/elastic/beats) at [x-pack/metricbeat/module/oracle/tablespace/data.go](https://github.com/elastic/beats/blob/0f8b65eea63c7c13597c9c0d5a7bdb1be663cf8a/x-pack/metricbeat/module/oracle/tablespace/data.go#L44-L46)

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 dataFile at line 45 may start a goroutine

[Click here to see the code in its original context.](https://github.com/elastic/beats/blob/0f8b65eea63c7c13597c9c0d5a7bdb1be663cf8a/x-pack/metricbeat/module/oracle/tablespace/data.go#L44-L46)

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

```go
for _, dataFile := range in.dataFiles {
m.addDataFileData(&dataFile, out)
}

```

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 {
"(Run, 2)" -> {"(handleError, 1)";"(run, 5)";}
"(setupFetchers, 2)" -> {"(Create, 2)";}
"(New, 6)" -> {"(Run, 1)";}
"(RunReloadableMonitors, 1)" -> {}
"(doRequest, 3)" -> {"(startProcessing, 3)";}
"(Unpack, 1)" -> {"(New, 2)";}
"(New, 2)" -> {"(newStore, 3)";"(New, 4)";}
"(run, 2)" -> {"(Run, 2)";}
"(CreateReporter, 1)" -> {}
"(processEventLog, 4)" -> {"(run, 4)";}
"(run, 5)" -> {"(doRequest, 3)";}
"(run, 4)" -> {}
"(handleError, 1)" -> {"(Fetch, 1)";}
"(FetchStats, 2)" -> {}
"(Start, 3)" -> {}
"(New, 1)" -> {"(Unpack, 1)";"(newBeater, 3)";"(setupFetchers, 2)";}
"(newBeater, 3)" -> {"(Unpack, 1)";}
"(Create, 2)" -> {"(New, 4)";"(workerFactory, 5)";}
"(workerFactory, 5)" -> {"(CreateReporter, 1)";"(New, 6)";}
"(New, 4)" -> {"(init, 4)";}
"(startProcessing, 3)" -> {}
"(Fetch, 1)" -> {"(FetchStats, 2)";}
"(addDataFileData, 2)" -> {"(SetSqlValueWithParentKey, 5)";}
"(SetSqlValueWithParentKey, 5)" -> {"(New, 1)";}
"(newStore, 3)" -> {}
"(init, 4)" -> {}
"(Run, 1)" -> {"(RunReloadableMonitors, 1)";"(processEventLog, 4)";"(Run, 2)";"(run, 2)";"(Start, 3)";}
}

```

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: 0f8b65eea63c7c13597c9c0d5a7bdb1be663cf8a

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with x-pack/metricbeat/module/oracle/tablespace/data.go at lines 44-46 and inspect addDataFileData and its call path. Determine whether the referenced range variable can be observed by a goroutine, then leave the requested Bug, Mitigated, or Desirable Behavior reaction as the completion signal.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.