github-vet / github-vet/rangeloop-pointer-findings
thingsplex/tpflow: flow/flow.go; 39 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [thingsplex/tpflow](https://www.github.com/thingsplex/tpflow) at [flow/flow.go](https://github.com/thingsplex/tpflow/blob/ea009cdcfa9fbb74bdb48fef6e9cc9f838093805/flow/flow.go#L98-L136)
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 metaNode at line 99 may start a goroutine
[Click here to see the code in its original context.](https://github.com/thingsplex/tpflow/blob/ea009cdcfa9fbb74bdb48fef6e9cc9f838093805/flow/flow.go#L98-L136)
Click here to show the 39 line(s) of Go which triggered the analyzer.
```go
for _, metaNode := range fl.FlowMeta.Nodes {
if !fl.IsNodeValid(&metaNode) {
fl.getLog().Errorf(" Node %s contains invalid configuration parameters ", metaNode.Label)
fl.opContext.State = "CONFIG_ERROR"
return
}
newNode := fl.GetNodeById(metaNode.Id)
if newNode == nil {
fl.getLog().Debugf(" Loading node NEW . Type = %s , Label = %s", metaNode.Type, metaNode.Label)
constructor, ok := node.Registry[metaNode.Type]
if ok {
newNode = constructor(&fl.opContext, metaNode, fl.globalContext)
newNode.SetConnectorRegistry(fl.connectorRegistry)
err = newNode.LoadNodeConfig()
if err != nil {
fl.getLog().Errorf(" Node type %s can't be loaded . Error : %s", metaNode.Type, err)
fl.opContext.State = "CONFIG_ERROR"
return
}
fl.AddNode(newNode)
} else {
fl.getLog().Errorf(" Node type = %s isn't supported. Node is skipped", metaNode.Type)
continue
}
} else {
fl.getLog().Infof(" Reusing existing node ")
}
fl.getLog().Debug(" Running Init() function of the node")
newNode.Init()
fl.getLog().Debug(" Done")
if newNode.IsStartNode() {
newNode.SetFlowRunner(fl.StartFlowInstance)
// Starts trigger node listener.When node is triggered , it executed in its own goroutine by fl.run method.
go newNode.WaitForEvent(nil)
}
fl.getLog().Debug(" Node is loaded and added.")
}
```
Click here to show extra information the analyzer produced.
```
The following paths through the callgraph could lead to a goroutine:
(IsNodeValid, 1) -> (getLog, 0) -> (WithFields, 1) -> (releaseEntry, 1) -> (Put, 1) -> (Reset, 0) -> (make, 1) -> (chkerr, 1) -> (Delete, 1) -> (copy, 2) -> (childAt, 1) -> (read, 1)
(IsNodeValid, 1) -> (getLog, 0) -> (WithFields, 1) -> (releaseEntry, 1) -> (Put, 1) -> (Reset, 0) -> (make, 1) -> (chkerr, 1) -> (Delete, 1) -> (copy, 2) -> (childAt, 1) -> (read, 1) -> (reindex, 0) -> (pgid, 1)
(IsNodeValid, 1) -> (getLog, 0) -> (WithFields, 1) -> (releaseEntry, 1) -> (Put, 1) -> (Reset, 0) -> (make, 1) -> (chkerr, 1) -> (Delete, 1) -> (copy, 2) -> (childAt, 1) -> (read, 1) -> (reindex, 0) -> (pgid, 1) -> (Infof, 2) -> (Logf, 3) -> (sendGetRequest, 1) -> (SendFimpWithTopicResponse, 6) -> (sendFimpWithTopicResponse, 7) -> (Info, 2)
(IsNodeValid, 1) -> (getLog, 0) -> (WithFields, 1) -> (releaseEntry, 1) -> (Put, 1) -> (Reset, 0) -> (make, 1) -> (chkerr, 1) -> (Delete, 1) -> (copy, 2) -> (childAt, 1) -> (read, 1) -> (reindex, 0) -> (pgid, 1) -> (Infof, 2) -> (Logf, 3) -> (sendGetRequest, 1) -> (SendFimpWithTopicResponse, 6) -> (sendFimpWithTopicResponse, 7) -> (Info, 2) -> (formatString, 1)
(IsNodeValid, 1) -> (getLog, 0) -> (WithFields, 1) -> (releaseEntry, 1) -> (Put, 1) -> (Reset, 0) -> (make, 1) -> (chkerr, 1) -> (Delete, 1) -> (copy, 2) -> (childAt, 1) -> (read, 1) -> (reindex, 0) -> (pgid, 1) -> (Infof, 2) -> (Logf, 3) -> (sendGetRequest, 1) -> (SendFimpWithTopicResponse, 6) -> (sendFimpWithTopicResponse, 7) -> (Info, 2) -> (formatString, 1) -> (persistOutbound, 2)
(IsNodeValid, 1) -> (getLog, 0) -> (WithFields, 1) -> (releaseEntry, 1) -> (Put, 1) -> (Reset, 0) -> (make, 1) -> (chkerr, 1) -> (Delete, 1) -> (copy, 2) -> (childAt, 1) -> (read, 1) -> (reindex, 0) -> (pgid, 1) -> (Infof, 2) -> (Logf, 3) -> (sendGetRequest, 1) -> (SendFimpWithTopicResponse, 6) -> (sendFimpWithTopicResponse, 7) -> (Info, 2) -> (formatString, 1) -> (persistOutbound, 2) -> (outboundKeyFromMID, 1) -> (entrySnapshot, 0)
(IsNodeValid, 1) -> (getLog, 0) -> (WithFields, 1) -> (releaseEntry, 1) -> (Put, 1) -> (Reset, 0) -> (make, 1) -> (chkerr, 1) -> (Delete, 1) -> (copy, 2) -> (childAt, 1) -> (read, 1) -> (reindex, 0) -> (pgid, 1) -> (Infof, 2) -> (Logf, 3) -> (sendGetRequest, 1) -> (SendFimpWithTopicResponse, 6) -> (sendFimpWithTopicResponse, 7) -> (Info, 2) -> (formatString, 1) -> (persistOutbound, 2) -> (outboundKeyFromMID, 1) -> (entrySnapshot, 0) -> (Run, 0)
(IsNodeValid, 1) -> (getLog, 0) -> (WithFields, 1) -> (releaseEntry, 1) -> (Put, 1) -> (Reset, 0) -> (make, 1) -> (chkerr, 1) -> (Delete, 1) -> (copy, 2) -> (childAt, 1) -> (read, 1) -> (reindex, 0)
(IsNodeValid, 1) -> (getLog, 0) -> (WithFields, 1) -> (releaseEntry, 1) -> (Put, 1) -> (Reset, 0) -> (make, 1) -> (chkerr, 1) -> (Delete, 1) -> (copy, 2) -> (childAt, 1) -> (read, 1) -> (reindex, 0) -> (pgid, 1) -> (Infof, 2) -> (Logf, 3)
(IsNodeValid, 1) -> (getLog, 0) -> (WithFields, 1) -> (releaseEntry, 1) -> (Put, 1) -> (Reset, 0) -> (make, 1) -> (chkerr, 1) -> (RemoveID, 1) -> (First, 0) -> (keyValue, 0) -> (value, 0) -> (Pointer, 1) -> (execFn, 1) -> (NewListIndex, 2) -> (IsLevelEnabled, 1)
(IsNodeValid, 1) -> (getLog, 0) -> (WithFields, 1) -> (releaseEntry, 1) -> (Put, 1) -> (Reset, 0) -> (make, 1) -> (chkerr, 1) -> (Delete, 1) -> (copy, 2) -> (childAt, 1) -> (read, 1) -> (reindex, 0) -> (pgid, 1) -> (Infof, 2) -> (Logf, 3) -> (mill, 0)
(IsNodeValid, 1) -> (getLog, 0) -> (WithFields, 1) -> (releaseEntry, 1) -> (Put, 1) -> (Reset, 0) -> (make, 1) -> (chkerr, 1) -> (Delete, 1) -> (copy, 2) -> (childAt, 1) -> (read, 1) -> (reindex, 0) -> (pgid, 1) -> (Infof, 2) -> (Logf, 3) -> (sendGetRequest, 1) -> (SendFimpWithTopicResponse, 6) -> (sendFimpWithTopicResponse, 7) -> (Info, 2) -> (formatString, 1) -> (persistOutbound, 2) -> (outboundKeyFromMID, 1)
(IsNodeValid, 1) -> (getLog, 0) -> (WithFields, 1) -> (releaseEntry, 1) -> (Put, 1) -> (Reset, 0) -> (make, 1) -> (chkerr, 1) -> (Delete, 1) -> (copy, 2) -> (childAt, 1) -> (read, 1) -> (reindex, 0) -> (pgid, 1) -> (Infof, 2) -> (Logf, 3) -> (sendGetRequest, 1) -> (SendFimpWithTopicResponse, 6) -> (sendFimpWithTopicResponse, 7) -> (Info, 2) -> (formatString, 1) -> (persistOutbound, 2) -> (outboundKeyFromMID, 1) -> (entrySnapshot, 0) -> (Run, 0) -> (f, 0)
```
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: ea009cdcfa9fbb74bdb48fef6e9cc9f838093805
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.