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

rajatchopra/ose-contiv: contrib/ingress/controllers/gce/controller/controller.go; 3 LoC

Open
#14,680 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 [rajatchopra/ose-contiv](https://www.github.com/rajatchopra/ose-contiv) at [contrib/ingress/controllers/gce/controller/controller.go](https://github.com/rajatchopra/ose-contiv/blob/0ff48115e6ad617b8937922bdb91eac89186b8f7/contrib/ingress/controllers/gce/controller/controller.go#L186-L188)

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 ing at line 187 may start a goroutine

[Click here to see the code in its original context.](https://github.com/rajatchopra/ose-contiv/blob/0ff48115e6ad617b8937922bdb91eac89186b8f7/contrib/ingress/controllers/gce/controller/controller.go#L186-L188)

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

```go
for _, ing := range ings {
lbc.ingQueue.enqueue(&ing)
}

```

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 {
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(RoundTrip, 1)" -> {"(dial, 1)";}
"(dial, 1)" -> {"(dialWithoutProxy, 1)";}
"(newClientTransport, 6)" -> {}
"(DialURL, 2)" -> {"(Dial, 3)";}
"(enqueue, 1)" -> {"(Add, 1)";}
"(Has, 1)" -> {"(Get, 1)";}
"(ServeHTTP, 2)" -> {"(tryUpgrade, 2)";}
"(tryUpgrade, 2)" -> {"(DialURL, 2)";}
"(dialWithoutProxy, 1)" -> {"(Dial, 3)";}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(Do, 3)" -> {}
"(Dial, 3)" -> {"(NewClientConn, 3)";}
"(Add, 1)" -> {"(Add, 2)";"(Get, 1)";"(Has, 1)";}
"(Add, 2)" -> {"(Do, 2)";"(Get, 1)";}
"(Do, 2)" -> {"(Copy, 2)";"(RoundTrip, 1)";}
"(Copy, 2)" -> {"(ServeHTTP, 2)";}
"(Get, 1)" -> {"(Get, 3)";"(Do, 2)";}
"(Get, 3)" -> {"(Do, 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: 0ff48115e6ad617b8937922bdb91eac89186b8f7

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in contrib/ingress/controllers/gce/controller/controller.go at lines 186-188 and inspect lbc.ingQueue.enqueue, including the Add path shown in the analyzer graph. Determine whether passing &ing through that path can produce the reported range-loop pointer problem, then classify the finding as Bug, Mitigated, or Desirable Behavior as requested by the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
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.