github-vet / github-vet/rangeloop-pointer-findings
oracle/cluster-manager: pkg/controller/cluster/clustercontroller.go; 16 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [oracle/cluster-manager](https://www.github.com/oracle/cluster-manager) at [pkg/controller/cluster/clustercontroller.go](https://github.com/oracle/cluster-manager/blob/7c11d45ed5d1912c86a4faffa15c43dee36ecd4c/pkg/controller/cluster/clustercontroller.go#L503-L518)
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 cluster at line 514 may start a goroutine
[Click here to see the code in its original context.](https://github.com/oracle/cluster-manager/blob/7c11d45ed5d1912c86a4faffa15c43dee36ecd4c/pkg/controller/cluster/clustercontroller.go#L503-L518)
Click here to show the 16 line(s) of Go which triggered the analyzer.
```go
for _, cluster := range clusters.Items {
if clusterStatus, ok := cluster.Annotations[navarkospkgcommon.NavarkosClusterStateKey]; ok {
if clusterStatus == navarkospkgcommon.NavarkosClusterStateProvisioning ||
clusterStatus == navarkospkgcommon.NavarkosClusterStateScalingUp ||
clusterStatus == navarkospkgcommon.NavarkosClusterStateScalingDown {
cc.validateCluster(&cluster, clusterStatus)
} else if clusterStatus == navarkospkgcommon.NavarkosClusterStateJoining {
cc.clusterJoin(&cluster)
}
}
}
```
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 {
"(dial, 2)" -> {"(NewServerConn, 2)";"(NewClientConn, 3)";}
"(addCluster, 1)" -> {}
"(StartWithLogFile, 2)" -> {}
"(Stat, 2)" -> {"(Get, 1)";}
"(Set, 1)" -> {"(Get, 1)";"(add, 1)";"(Add, 1)";}
"(newWatchBroadcasts, 1)" -> {}
"(NewKubernetesSource, 1)" -> {}
"(Delete, 3)" -> {"(Do, 2)";"(Get, 3)";}
"(List, 2)" -> {}
"(delete, 1)" -> {"(Find, 1)";"(Get, 2)";"(Delete, 1)";"(Update, 1)";}
"(initKubeletConfigSync, 1)" -> {"(startKubeletConfigSyncLoop, 2)";}
"(serverHandshake, 1)" -> {"(newServerTransport, 4)";}
"(clusterJoin, 1)" -> {"(resetCluster, 1)";"(createClusterSecrets, 2)";}
"(resetCluster, 1)" -> {"(deleteCluster, 1)";"(createCluster, 1)";"(CheckIfFunctionHasError, 5)";}
"(Open, 2)" -> {}
"(New, 2)" -> {"(Start, 1)";}
"(StartControllers, 2)" -> {}
"(Remove, 1)" -> {"(Find, 1)";"(Remove, 2)";}
"(setupIO, 6)" -> {"(createTty, 4)";"(createStdioPipes, 3)";}
"(CheckIfFunctionHasError, 5)" -> {"(New, 1)";}
"(newClient, 1)" -> {"(dial, 2)";"(NewLease, 1)";}
"(GetService, 3)" -> {"(Get, 3)";}
"(clientLoop, 2)" -> {}
"(Get, 0)" -> {"(Get, 2)";}
"(CreateSecret, 2)" -> {"(Create, 3)";}
"(startKubelet, 4)" -> {}
"(addConnIfNeeded, 3)" -> {}
"(RestartNode, 1)" -> {}
"(NewServerConn, 2)" -> {"(serverHandshake, 1)";}
"(newClientTransport, 6)" -> {}
"(createCluster, 1)" -> {"(Create, 1)";"(CheckIfFunctionHasError, 5)";}
"(Run, 1)" -> {"(StartControllers, 2)";"(StartBackoffGC, 2)";"(NewSSHTunnelList, 4)";"(run, 1)";"(Build, 1)";"(Run, 0)";}
"(Get, 1)" -> {"(List, 2)";"(Get, 2)";}
"(run, 2)" -> {"(initKubeletConfigSync, 1)";"(RunKubelet, 5)";}
"(Get, 2)" -> {"(handle, 1)";"(Open, 2)";}
"(Apply, 1)" -> {"(Put, 2)";"(Get, 2)";}
"(startKubeletConfigSyncLoop, 2)" -> {}
"(CreateKubeconfigSecret, 7)" -> {"(CreateSecret, 2)";"(Write, 1)";"(Create, 1)";}
"(List, 1)" -> {"(Do, 2)";"(List, 2)";}
"(Delete, 2)" -> {"(delete, 1)";"(List, 4)";"(Stat, 2)";"(GetService, 3)";"(Do, 3)";"(Do, 1)";"(Delete, 3)";"(delete, 2)";"(Remove, 1)";}
"(Start, 1)" -> {"(Run, 1)";"(StartWithLogFile, 2)";}
"(tryUpgrade, 2)" -> {}
"(Unmarshal, 2)" -> {"(Add, 1)";"(Set, 1)";"(Get, 1)";}
"(add, 1)" -> {"(post, 1)";"(newWatchBroadcast, 3)";"(newWatchBroadcasts, 1)";}
"(Update, 1)" -> {"(Get, 2)";}
"(restartAsStandaloneNode, 2)" -> {"(RestartNode, 1)";}
"(Create, 1)" -> {"(Apply, 1)";"(Update, 1)";"(Run, 2)";"(New, 1)";"(Get, 1)";"(Unmarshal, 2)";"(Set, 1)";"(Add, 1)";}
"(NewFederatedInformer, 3)" -> {"(addCluster, 1)";}
"(configureTransport, 1)" -> {"(addConnIfNeeded, 3)";}
"(Build, 1)" -> {"(NewKubernetesSource, 1)";}
"(Delete, 1)" -> {"(Get, 2)";}
"(New, 1)" -> {"(SetTransportDefaults, 1)";"(Start, 1)";"(Run, 2)";"(New, 2)";"(NewFederatedInformer, 3)";"(Add, 1)";"(newClient, 1)";"(Run, 1)";"(List, 1)";"(Update, 1)";}
"(StartControllers, 7)" -> {}
"(NewLease, 1)" -> {}
"(handle, 1)" -> {}
"(post, 1)" -> {}
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(FromURL, 2)" -> {"(Dial, 3)";}
"(delete, 2)" -> {"(Do, 3)";"(Delete, 3)";}
"(Do, 1)" -> {"(ServeHTTP, 2)";"(Get, 1)";}
"(createAggregatorServer, 4)" -> {}
"(StartBackoffGC, 2)" -> {}
"(Get, 3)" -> {"(List, 2)";}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
"(RunServer, 3)" -> {}
"(startNode, 3)" -> {"(StartNode, 2)";}
"(deleteCluster, 1)" -> {"(delete, 2)";"(CheckIfFunctionHasError, 5)";"(Delete, 2)";}
"(ServeHTTP, 2)" -> {"(tryUpgrade, 2)";"(Do, 2)";"(tryUpgrade, 7)";}
"(Update, 3)" -> {"(Do, 2)";"(add, 1)";}
"(Add, 1)" -> {"(add, 1)";}
"(ConfigureTransport, 1)" -> {"(configureTransport, 1)";}
"(RunKubelet, 5)" -> {"(startKubelet, 4)";}
"(serveInsecurely, 3)" -> {"(RunServer, 3)";}
"(Do, 3)" -> {"(Copy, 2)";"(Do, 1)";}
"(createSecret, 7)" -> {"(CreateKubeconfigSecret, 7)";}
"(tryUpgrade, 7)" -> {}
"(newLeaseUpdater, 3)" -> {}
"(Create, 3)" -> {"(Get, 2)";}
"(createTty, 4)" -> {}
"(StartNode, 2)" -> {}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(Dial, 3)" -> {"(NewClientConn, 3)";}
"(createClusterSecrets, 2)" -> {"(createSecret, 7)";}
"(Do, 2)" -> {}
"(NewSSHTunnelList, 4)" -> {}
"(Write, 1)" -> {"(Log, 1)";"(Update, 3)";"(Do, 1)";"(Get, 1)";"(Add, 1)";"(Get, 0)";"(Copy, 2)";}
"(Find, 1)" -> {"(List, 2)";"(Get, 2)";}
"(run, 1)" -> {"(NewServer, 1)";"(setupIO, 6)";}
"(restartNode, 2)" -> {"(RestartNode, 1)";}
"(newServerTransport, 4)" -> {}
"(Run, 2)" -> {"(Open, 2)";"(createAggregatorServer, 4)";"(Run, 0)";"(Run, 1)";"(Start, 2)";"(run, 2)";"(Import, 1)";"(FromURL, 2)";"(StartControllers, 7)";"(StartBackoffGC, 2)";"(run, 1)";"(Copy, 2)";"(NonBlockingRun, 3)";"(add, 1)";}
"(Copy, 2)" -> {"(ServeHTTP, 2)";}
"(Put, 2)" -> {"(handle, 1)";}
"(createStdioPipes, 3)" -> {}
"(Start, 2)" -> {}
"(NonBlockingRun, 3)" -> {"(serveInsecurely, 3)";}
"(Log, 1)" -> {"(Copy, 2)";}
"(List, 4)" -> {"(List, 1)";}
"(Remove, 2)" -> {"(Do, 2)";}
"(newWatchBroadcast, 3)" -> {}
"(Run, 0)" -> {"(clientLoop, 2)";"(Build, 1)";"(RunKubelet, 5)";"(run, 1)";}
"(Import, 1)" -> {"(newLeaseUpdater, 3)";}
"(NewServer, 1)" -> {"(startNode, 3)";"(restartNode, 2)";"(restartAsStandaloneNode, 2)";}
}
```
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: 7c11d45ed5d1912c86a4faffa15c43dee36ecd4c
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.