github-vet / github-vet/rangeloop-pointer-findings
codeamp/circuit: plugins/codeamp/graphql/service_mutation.go; 4 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [codeamp/circuit](https://www.github.com/codeamp/circuit) at [plugins/codeamp/graphql/service_mutation.go](https://github.com/codeamp/circuit/blob/06371150b7aaaf104d41907c6f432a795238bf3c/plugins/codeamp/graphql/service_mutation.go#L147-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 h at line 149 may start a goroutine
[Click here to see the code in its original context.](https://github.com/codeamp/circuit/blob/06371150b7aaaf104d41907c6f432a795238bf3c/plugins/codeamp/graphql/service_mutation.go#L147-L150)
Click here to show the 4 line(s) of Go which triggered the analyzer.
```go
for _, h := range service.ReadinessProbe.HttpHeaders {
h.HealthProbeID = service.ReadinessProbe.ID
r.DB.Create(&h)
}
```
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 {
"(Scan, 1)" -> {"(Set, 2)";}
"(RoundTripOpt, 2)" -> {"(roundTrip, 1)";}
"(Connect, 1)" -> {"(newSocket, 3)";}
"(Execute, 3)" -> {"(execSelections, 6)";}
"(Call, 3)" -> {"(Remove, 1)";}
"(setupIO, 5)" -> {"(createTty, 3)";"(createStdioPipes, 2)";}
"(newServerConn, 4)" -> {}
"(get, 1)" -> {"(New, 3)";"(SetTransportDefaults, 1)";}
"(Add, 1)" -> {"(Call, 3)";}
"(NewDaemon, 4)" -> {}
"(newSecureAPI, 2)" -> {"(ServeHTTP, 2)";}
"(Start, 1)" -> {"(start, 1)";}
"(apply, 1)" -> {"(Delete, 1)";}
"(run, 1)" -> {"(setupIO, 5)";"(Start, 1)";}
"(addConnIfNeeded, 3)" -> {}
"(unmarshalValue, 3)" -> {"(SetExtension, 3)";}
"(New, 1)" -> {"(Connect, 1)";"(apply, 2)";"(get, 1)";}
"(Do, 3)" -> {}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
"(awaitOpenSlotForRequest, 1)" -> {}
"(create, 3)" -> {"(Get, 2)";}
"(Get, 2)" -> {"(Do, 2)";}
"(monitorConnection, 1)" -> {}
"(UnmarshalNext, 2)" -> {"(unmarshalValue, 3)";}
"(ServeHTTP, 2)" -> {"(NewServer, 3)";"(newServerConn, 4)";"(tryUpgrade, 2)";}
"(updateHealthMonitor, 1)" -> {"(monitor, 4)";}
"(Dial, 1)" -> {"(dial, 2)";}
"(RoundTrip, 1)" -> {"(runCancelable, 2)";"(roundTrip, 1)";"(RoundTripOpt, 2)";}
"(Set, 2)" -> {"(Do, 3)";}
"(Unmarshal, 2)" -> {"(ReturnIterator, 1)";"(UnmarshalNext, 2)";"(New, 1)";"(Unmarshal, 1)";"(Set, 1)";}
"(createStdioPipes, 2)" -> {}
"(containerStart, 4)" -> {"(initHealthMonitor, 1)";}
"(DialForUpgrade, 1)" -> {"(dial, 2)";"(WrapRequest, 1)";}
"(monitor, 4)" -> {}
"(runCancelable, 2)" -> {}
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(start, 1)" -> {"(NewDaemon, 4)";"(shutdownDaemon, 1)";"(handleControlSocketChange, 2)";"(loadListeners, 2)";"(ContainerStart, 4)";}
"(ReturnIterator, 1)" -> {"(Put, 1)";}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(New, 3)" -> {"(monitorConnection, 1)";"(configureTLS, 4)";"(Remove, 1)";}
"(SetExtension, 3)" -> {"(extensionProperties, 1)";}
"(dial, 2)" -> {"(NewClientConn, 3)";"(NewServerConn, 2)";}
"(NewServerConn, 2)" -> {"(serverHandshake, 1)";}
"(newSocket, 3)" -> {}
"(execSelections, 6)" -> {"(execFieldSelection, 5)";}
"(tryUpgrade, 2)" -> {"(DialForUpgrade, 1)";"(ConnectWithRedirects, 5)";}
"(configureTransport, 1)" -> {"(addConnIfNeeded, 3)";}
"(ListenPipe, 2)" -> {}
"(Do, 2)" -> {}
"(Init, 4)" -> {"(ListenPipe, 2)";}
"(ConnectWithRedirects, 5)" -> {"(Dial, 1)";}
"(newServerTransport, 4)" -> {}
"(Set, 1)" -> {"(Set, 2)";"(Scan, 1)";}
"(Unmarshal, 1)" -> {"(New, 3)";}
"(apply, 2)" -> {"(Remove, 1)";"(apply, 1)";}
"(Put, 1)" -> {"(Remove, 1)";}
"(Delete, 2)" -> {"(Do, 2)";}
"(execSelectionSet, 6)" -> {}
"(Create, 1)" -> {"(Create, 3)";"(New, 1)";"(Set, 1)";"(Run, 2)";"(Unmarshal, 2)";"(Add, 1)";}
"(Run, 2)" -> {"(Execute, 3)";"(Run, 1)";}
"(Delete, 1)" -> {"(Do, 2)";}
"(execFieldSelection, 5)" -> {"(execSelectionSet, 6)";}
"(Remove, 1)" -> {"(Remove, 2)";"(Delete, 2)";}
"(Create, 3)" -> {"(create, 3)";}
"(NewContext, 3)" -> {"(newRoutableUntypedAPI, 3)";}
"(NewServer, 3)" -> {}
"(loadListeners, 2)" -> {"(Init, 4)";}
"(ContainerStart, 4)" -> {"(containerStart, 4)";}
"(newClientTransport, 6)" -> {}
"(Run, 1)" -> {"(Start, 1)";"(run, 1)";"(NewContext, 3)";}
"(shutdownDaemon, 1)" -> {}
"(handleControlSocketChange, 2)" -> {}
"(extensionProperties, 1)" -> {"(Init, 4)";}
"(roundTrip, 1)" -> {"(awaitOpenSlotForRequest, 1)";}
"(configureTLS, 4)" -> {}
"(createTty, 3)" -> {}
"(newRoutableUntypedAPI, 3)" -> {"(newSecureAPI, 2)";}
"(initHealthMonitor, 1)" -> {"(updateHealthMonitor, 1)";}
"(WrapRequest, 1)" -> {"(RoundTrip, 1)";}
"(serverHandshake, 1)" -> {"(newServerTransport, 4)";}
"(Remove, 2)" -> {}
"(ConfigureTransport, 1)" -> {"(configureTransport, 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: 06371150b7aaaf104d41907c6f432a795238bf3c
Contributor guide
No contributing guide indexed for this repository
Research direction
Inspect plugins/codeamp/graphql/service_mutation.go at lines 147-150 and determine whether the analyzer's range-loop warning represents a real bug in the call to r.DB.Create(&h). Review the surrounding mutation logic and classify the finding as Bug, Mitigated, or Desirable Behavior; done means the classification is supported by the observed behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100