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

praparn/kubernetes_201904: WorkShop_2.5_Kubernetes_RealWorld/ingress-nginx/internal/ingress/types_equals.go; 12 LoC

Open
#13,399 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 [praparn/kubernetes_201904](https://www.github.com/praparn/kubernetes_201904) at [WorkShop_2.5_Kubernetes_RealWorld/ingress-nginx/internal/ingress/types_equals.go](https://github.com/praparn/kubernetes_201904/blob/92c6c826b9a75a27925c13dcf921100d54c3e015/WorkShop_2.5_Kubernetes_RealWorld/ingress-nginx/internal/ingress/types_equals.go#L75-L86)

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 udp1 at line 78 may start a goroutine

[Click here to see the code in its original context.](https://github.com/praparn/kubernetes_201904/blob/92c6c826b9a75a27925c13dcf921100d54c3e015/WorkShop_2.5_Kubernetes_RealWorld/ingress-nginx/internal/ingress/types_equals.go#L75-L86)

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

```go
for _, udp1 := range c1.UDPEndpoints {
found := false
for _, udp2 := range c2.UDPEndpoints {
if (&udp1).Equal(&udp2) {
found = true
break
}
}
if !found {
return false
}
}

```

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)";}
"(NewLease, 1)" -> {}
"(ConfigureTransport, 1)" -> {"(configureTransport, 1)";}
"(parseExtensions, 1)" -> {"(parseExtension, 1)";}
"(parse, 1)" -> {"(Push, 1)";"(copy, 2)";"(append, 1)";"(New, 1)";"(Parse, 1)";}
"(Do, 2)" -> {"(RoundTrip, 1)";}
"(copy, 2)" -> {"(get, 1)";"(findObject, 2)";}
"(NewServerConn, 2)" -> {"(serverHandshake, 1)";}
"(newServerTransport, 4)" -> {}
"(Set, 2)" -> {"(Do, 3)";}
"(applyRequest, 1)" -> {"(Copy, 2)";}
"(parse, 2)" -> {"(Set, 1)";"(parseTag, 1)";"(parseExtensions, 1)";"(parse, 1)";}
"(Set, 1)" -> {"(New, 1)";"(Add, 2)";"(New, 2)";"(Parse, 1)";}
"(Parse, 1)" -> {"(Set, 2)";}
"(Copy, 2)" -> {"(ServeHTTP, 2)";}
"(Merge, 1)" -> {"(Set, 2)";}
"(awaitOpenSlotForRequest, 1)" -> {}
"(Equal, 1)" -> {"(Compare, 1)";}
"(Compare, 1)" -> {"(parse, 2)";}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(parseTag, 1)" -> {"(copy, 2)";}
"(Get, 1)" -> {"(Get, 2)";}
"(get, 1)" -> {"(Get, 1)";"(SetTransportDefaults, 1)";}
"(append, 1)" -> {}
"(RoundTrip, 1)" -> {"(awaitOpenSlotForRequest, 1)";}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
"(ServeHTTP, 2)" -> {"(tryUpgrade, 2)";"(tryUpgrade, 7)";}
"(addConnIfNeeded, 3)" -> {}
"(newClientTransport, 6)" -> {}
"(tryUpgrade, 7)" -> {}
"(New, 1)" -> {"(Merge, 1)";"(get, 1)";"(newClient, 1)";"(Start, 1)";"(New, 2)";"(apply, 2)";"(Parse, 1)";}
"(Add, 2)" -> {"(Do, 2)";}
"(Push, 1)" -> {"(Set, 2)";}
"(parseExtension, 1)" -> {"(copy, 2)";}
"(tryUpgrade, 2)" -> {}
"(newClient, 1)" -> {"(NewLease, 1)";"(dial, 2)";}
"(Do, 3)" -> {}
"(configureTransport, 1)" -> {"(addConnIfNeeded, 3)";}
"(findObject, 2)" -> {"(get, 1)";}
"(Get, 2)" -> {"(handle, 2)";}
"(handle, 2)" -> {"(ServeHTTP, 2)";}
"(serverHandshake, 1)" -> {"(newServerTransport, 4)";}
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(New, 2)" -> {"(Start, 1)";}
"(apply, 2)" -> {"(applyRequest, 1)";}
"(Start, 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: 92c6c826b9a75a27925c13dcf921100d54c3e015

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with WorkShop_2.5_Kubernetes_RealWorld/ingress-nginx/internal/ingress/types_equals.go at the reported lines and inspect the Equal entry point and analyzer call graph. Determine whether the reported reference can lead to a goroutine in this context; done means recording the appropriate Bug, Mitigated, or Desirable Behavior classification.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.