github-vet / github-vet/rangeloop-pointer-findings
kubernetes-cn/kubernetes: test/e2e/scheduling/priorities.go; 11 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [kubernetes-cn/kubernetes](https://www.github.com/kubernetes-cn/kubernetes) at [test/e2e/scheduling/priorities.go](https://github.com/kubernetes-cn/kubernetes/blob/c3bec0bae43b4c46800a13f44534ce6cd14b5f40/test/e2e/scheduling/priorities.go#L327-L337)
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 pod at line 331 may start a goroutine
[Click here to see the code in its original context.](https://github.com/kubernetes-cn/kubernetes/blob/c3bec0bae43b4c46800a13f44534ce6cd14b5f40/test/e2e/scheduling/priorities.go#L327-L337)
Click here to show the 11 line(s) of Go which triggered the analyzer.
```go
for _, pod := range allpods.Items {
if pod.Spec.NodeName == node.Name {
framework.Logf("Pod for on the node: %v, Cpu: %v, Mem: %v", pod.Name, getNonZeroRequests(&pod).MilliCPU, getNonZeroRequests(&pod).Memory)
// Ignore best effort pods while computing fractions as they won't be taken in account by scheduler.
if v1qos.GetPodQOS(&pod) == v1.PodQOSBestEffort {
continue
}
totalRequestedCpuResource += getNonZeroRequests(&pod).MilliCPU
totalRequestedMemResource += getNonZeroRequests(&pod).Memory
}
}
```
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)" -> {"(DialURL, 3)";}
"(DialURL, 3)" -> {"(Dial, 3)";}
"(dial, 1)" -> {"(dialWithoutProxy, 2)";}
"(start, 1)" -> {"(startEtcd, 1)";}
"(configureTransport, 1)" -> {"(addConnIfNeeded, 3)";}
"(Validate, 2)" -> {"(Dispatch, 2)";}
"(buildKubeletClientConfig, 2)" -> {"(UpdateTransport, 4)";}
"(Dial, 3)" -> {"(NewClientConn, 3)";}
"(drainRespBody, 1)" -> {"(Copy, 2)";}
"(ListenPipe, 2)" -> {}
"(roundTrip, 1)" -> {"(awaitOpenSlotForRequest, 1)";}
"(run, 1)" -> {"(stop, 1)";"(addNode, 1)";}
"(serveResource, 6)" -> {"(DeleteCollection, 4)";}
"(UpdatePod, 1)" -> {}
"(newClient, 1)" -> {"(grpcHealthCheck, 2)";"(dial, 2)";}
"(Get, 2)" -> {"(Accept, 2)";"(Get, 3)";}
"(Terminate, 1)" -> {}
"(handleHttps, 2)" -> {}
"(Run, 1)" -> {"(run, 1)";"(Register, 2)";"(copyToPod, 3)";"(NewSSHTunnelList, 4)";"(start, 1)";"(Run, 2)";"(stop, 1)";}
"(CreateControllerContext, 4)" -> {}
"(insert, 1)" -> {"(Search, 2)";}
"(addConnIfNeeded, 3)" -> {}
"(Dispatch, 4)" -> {}
"(NewUnsecuredEtcd3TestClientServer, 1)" -> {"(NewClusterV3, 2)";}
"(newWatchBroadcasts, 1)" -> {}
"(Start, 1)" -> {"(start, 1)";"(CreateListener, 1)";"(Run, 1)";}
"(Add, 2)" -> {"(New, 1)";"(Write, 3)";"(Insert, 2)";"(Search, 2)";"(New, 3)";}
"(ServeHTTP, 2)" -> {"(tryUpgrade, 2)";"(handleHttps, 2)";"(proxy, 2)";"(Dispatch, 2)";"(serveResource, 6)";}
"(Get, 1)" -> {"(Get, 2)";}
"(proxy, 2)" -> {}
"(NewMainKubelet, 31)" -> {}
"(AddNode, 1)" -> {"(addNode, 1)";}
"(add, 2)" -> {"(New, 1)";"(add, 1)";}
"(Search, 2)" -> {"(List, 1)";}
"(List, 2)" -> {}
"(Verifier, 1)" -> {"(newAsyncIDTokenVerifier, 3)";}
"(copyToPod, 3)" -> {}
"(ConfigureTransport, 1)" -> {"(configureTransport, 1)";}
"(startKubelet, 5)" -> {}
"(startEtcd, 1)" -> {"(NewUnsecuredEtcd3TestClientServer, 1)";}
"(Write, 1)" -> {"(Copy, 2)";}
"(startZfsWatcher, 1)" -> {}
"(DeleteCollection, 3)" -> {}
"(simulate, 3)" -> {"(AddPod, 1)";}
"(Write, 3)" -> {"(Write, 1)";}
"(Register, 3)" -> {"(startThinPoolWatcher, 1)";"(startZfsWatcher, 1)";}
"(RunKubelet, 3)" -> {"(startKubelet, 5)";"(createAndInitKubelet, 31)";}
"(updateTransport, 5)" -> {"(addCertRotation, 6)";}
"(add, 1)" -> {"(post, 1)";"(newWatchBroadcast, 3)";"(newWatchBroadcasts, 1)";"(New, 1)";}
"(newWatchBroadcast, 3)" -> {}
"(Delete, 1)" -> {"(Get, 2)";"(drainRespBody, 1)";"(New, 1)";"(Delete, 2)";"(Delete, 3)";}
"(Copy, 2)" -> {"(ServeHTTP, 2)";"(AddNode, 1)";}
"(addCertRotation, 6)" -> {}
"(newClientTransport, 6)" -> {}
"(grpcHealthCheck, 2)" -> {"(dial, 1)";}
"(Delete, 3)" -> {"(Validate, 1)";}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(Run, 2)" -> {"(CreateControllerContext, 4)";"(Register, 3)";"(run, 1)";}
"(CreateListener, 1)" -> {"(ListenPipe, 2)";}
"(stop, 1)" -> {"(Terminate, 1)";}
"(Dispatch, 2)" -> {"(Dispatch, 4)";}
"(run, 3)" -> {"(RunKubelet, 3)";"(buildKubeletClientConfig, 2)";}
"(Insert, 2)" -> {"(drainRespBody, 1)";}
"(Put, 1)" -> {"(drainRespBody, 1)";"(Update, 3)";"(Create, 5)";}
"(NewClusterV3, 2)" -> {"(Launch, 1)";}
"(RoundTrip, 1)" -> {"(roundTrip, 1)";"(RoundTripOpt, 2)";}
"(awaitOpenSlotForRequest, 1)" -> {}
"(Get, 3)" -> {"(Validate, 1)";}
"(Create, 5)" -> {"(Validate, 1)";}
"(Push, 2)" -> {"(New, 1)";"(Get, 0)";"(Put, 1)";}
"(NewSSHTunnelList, 4)" -> {}
"(newAsyncIDTokenVerifier, 3)" -> {}
"(addEndpoint, 1)" -> {}
"(Launch, 1)" -> {}
"(AddPod, 1)" -> {"(UpdatePod, 1)";}
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(dialWithoutProxy, 2)" -> {"(Dial, 3)";}
"(Register, 2)" -> {"(addEndpoint, 1)";}
"(Update, 3)" -> {"(Accept, 2)";}
"(get, 1)" -> {"(Get, 1)";"(SetTransportDefaults, 1)";}
"(startThinPoolWatcher, 1)" -> {}
"(Run, 3)" -> {"(run, 3)";}
"(New, 3)" -> {"(New, 2)";}
"(Delete, 2)" -> {"(Accept, 2)";}
"(List, 1)" -> {"(List, 2)";"(Validate, 1)";}
"(tryUpgrade, 2)" -> {}
"(RoundTripOpt, 2)" -> {"(roundTrip, 1)";}
"(DeleteCollection, 4)" -> {"(DeleteCollection, 3)";}
"(nodeShouldRunDaemonPod, 2)" -> {"(simulate, 3)";}
"(New, 2)" -> {"(Start, 1)";}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
"(Validate, 1)" -> {"(Validate, 2)";}
"(UpdateTransport, 4)" -> {"(updateTransport, 5)";}
"(addNode, 1)" -> {"(nodeShouldRunDaemonPod, 2)";}
"(GetPodQOS, 1)" -> {"(Add, 1)";}
"(Add, 1)" -> {"(Add, 2)";"(add, 2)";"(get, 1)";"(delete, 1)";"(insert, 1)";"(add, 1)";"(New, 1)";"(Push, 2)";"(Delete, 1)";"(Search, 2)";"(Has, 1)";}
"(Accept, 2)" -> {}
"(delete, 1)" -> {"(Delete, 1)";}
"(createAndInitKubelet, 31)" -> {"(NewMainKubelet, 31)";}
"(post, 1)" -> {"(RoundTrip, 1)";}
"(New, 1)" -> {"(New, 2)";"(Start, 1)";"(Run, 3)";"(newClient, 1)";"(Run, 1)";"(Run, 2)";"(Verifier, 1)";}
"(Has, 1)" -> {"(Get, 1)";}
"(Get, 0)" -> {"(Get, 2)";"(Get, 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: c3bec0bae43b4c46800a13f44534ce6cd14b5f40
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.