github-vet / github-vet/rangeloop-pointer-findings
luizbafilho/fusis: health/monitor.go; 13 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [luizbafilho/fusis](https://www.github.com/luizbafilho/fusis) at [health/monitor.go](https://github.com/luizbafilho/fusis/blob/22c38b193875a17eeeaf1fd1efd40698ed5ad424/health/monitor.go#L138-L150)
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 svc at line 139 may start a goroutine
[Click here to see the code in its original context.](https://github.com/luizbafilho/fusis/blob/22c38b193875a17eeeaf1fd1efd40698ed5ad424/health/monitor.go#L138-L150)
Click here to show the 13 line(s) of Go which triggered the analyzer.
```go
for _, svc := range s.GetServices() {
for _, dst := range s.GetDestinations(&svc) {
checkId := fmt.Sprintf("%s:%s", svc.GetId(), dst.GetId())
m.RLock()
if check, ok := m.runningChecks[checkId]; ok {
if check.GetStatus() == BAD {
logrus.Debugf("[health-monitor] filtering %#v. Check %s", dst, check.GetId())
s.DeleteDestination(dst)
}
}
m.RUnlock()
}
}
```
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 {
"(newClient, 1)" -> {"(newHealthBalancer, 3)";"(dial, 2)";}
"(dial, 2)" -> {"(NewServerConn, 2)";"(NewClientConn, 3)";}
"(Remove, 1)" -> {"(Insert, 2)";"(Delete, 1)";}
"(Get, 1)" -> {"(New, 1)";"(Remove, 1)";"(index, 1)";}
"(New, 1)" -> {"(newClient, 1)";}
"(RoundTrip, 1)" -> {"(awaitOpenSlotForRequest, 1)";}
"(Get, 3)" -> {"(Do, 3)";"(get, 2)";}
"(generateData, 2)" -> {"(New, 2)";}
"(get, 2)" -> {"(Add, 1)";"(Add, 3)";}
"(post, 1)" -> {"(RoundTrip, 1)";}
"(New, 2)" -> {"(NewSession, 2)";}
"(GetDestinations, 1)" -> {"(Get, 3)";"(Get, 1)";"(doGetDestinationsCmd, 2)";}
"(add, 1)" -> {"(post, 1)";"(newWatchBroadcast, 3)";"(newWatchBroadcasts, 1)";}
"(index, 1)" -> {"(update, 1)";}
"(update, 1)" -> {"(Add, 1)";}
"(serverHandshake, 1)" -> {"(newServerTransport, 4)";}
"(doGetDestinationsCmd, 2)" -> {"(doCmdwithResponse, 3)";}
"(Send, 1)" -> {"(generateData, 2)";}
"(Do, 3)" -> {}
"(Add, 1)" -> {"(add, 1)";}
"(newWatchBroadcast, 3)" -> {}
"(Insert, 2)" -> {"(Add, 1)";}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(NewSession, 2)" -> {}
"(newWatchBroadcasts, 1)" -> {}
"(Delete, 1)" -> {"(Add, 1)";}
"(NewServerConn, 2)" -> {"(serverHandshake, 1)";}
"(newServerTransport, 4)" -> {}
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(newClientTransport, 6)" -> {}
"(awaitOpenSlotForRequest, 1)" -> {}
"(newHealthBalancer, 3)" -> {}
"(Add, 3)" -> {"(Set, 1)";}
"(Set, 1)" -> {"(add, 1)";}
"(doCmdwithResponse, 3)" -> {"(execute, 3)";}
"(execute, 3)" -> {"(Send, 1)";}
}
```
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: 22c38b193875a17eeeaf1fd1efd40698ed5ad424
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.