github-vet / github-vet/rangeloop-pointer-findings
openark/orchestrator: go/logic/snapshot_data.go; 6 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [openark/orchestrator](https://www.github.com/openark/orchestrator) at [go/logic/snapshot_data.go](https://github.com/openark/orchestrator/blob/41fdb4756dfc15ef99d3ef6ee21be8335eae5528/go/logic/snapshot_data.go#L157-L162)
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 existingKey at line 159 may start a goroutine
[Click here to see the code in its original context.](https://github.com/openark/orchestrator/blob/41fdb4756dfc15ef99d3ef6ee21be8335eae5528/go/logic/snapshot_data.go#L157-L162)
Click here to show the 6 line(s) of Go which triggered the analyzer.
```go
for _, existingKey := range existingKeys {
if !snapshotInstanceKeyMap.HasKey(existingKey) {
inst.ForgetInstance(&existingKey)
discardedKeys++
}
}
```
Click here to show extra information the analyzer produced.
```
The following paths through the callgraph could lead to a goroutine:
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (run, 0) -> (runLeader, 0) -> (leaderLoop, 0) -> (checkLeaderLease, 0) -> (pipelineReplicate, 1) -> (pipelineSend, 4) -> (AppendEntries, 2)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (read, 1) -> (Fatale, 1) -> (Exit, 1) -> (readInto, 4) -> (NewNetworkTransportWithLogger, 4) -> (listen, 0) -> (handleConn, 1) -> (handleCommand, 3)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (CreateOrReturnCollection, 1)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Next, 0) -> (Fatalf, 3) -> (runLeader, 0) -> (leaderLoop, 0) -> (goFunc, 1)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Read, 1) -> (decode, 1) -> (decMapInt64Intf, 1) -> (readMapLen, 0) -> (restoreSnapshot, 0) -> (setLastSnapshot, 2)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Read, 1) -> (decode, 1) -> (decMapInt64Intf, 1) -> (readMapLen, 0) -> (NewNetworkTransport, 4) -> (NewNetworkTransportWithLogger, 4) -> (listen, 0)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (read, 1) -> (Fatale, 1) -> (Exit, 1) -> (readInto, 4) -> (WithDeadline, 2) -> (cancel, 2) -> (removeChild, 2)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (GetClusterName, 1) -> (GetString, 1) -> (openDB, 0) -> (Infof, 2) -> (ToSqlite3Insert, 1)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Read, 1) -> (decode, 1) -> (decMapInt64Intf, 1) -> (readMapLen, 0) -> (goFunc, 1)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Read, 1) -> (decode, 1) -> (decMapInt64Intf, 1) -> (readMapLen, 0) -> (startWatcher, 0)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (run, 0) -> (runLeader, 0) -> (leaderLoop, 0) -> (checkLeaderLease, 0) -> (WaitEventChan, 2)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (GetClusterName, 1) -> (GetString, 1) -> (QueryRowsMap, 4) -> (ScanRowsToMaps, 2) -> (on_row, 1)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (read, 1) -> (Fatale, 1) -> (Exit, 1) -> (readInto, 4) -> (Restore, 1)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Read, 1) -> (decode, 1) -> (decMapInt64Intf, 1) -> (readMapLen, 0) -> (NewNetworkTransport, 4) -> (NewNetworkTransportWithLogger, 4) -> (listen, 0) -> (handleConn, 1) -> (handleCommand, 3)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (read, 1) -> (Fatale, 1) -> (Exit, 1) -> (readInto, 4) -> (initializeInstanceDao, 0)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Next, 0) -> (Fatalf, 3) -> (runLeader, 0) -> (leaderLoop, 0) -> (init, 0) -> (newSeed, 0)
(ForgetInstance, 1) -> (AuditOperation, 3)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (newCacheWithJanitor, 3) -> (runJanitor, 2)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Set, 2) -> (string, 1) -> (Exit, 1)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (openDB, 0) -> (Infof, 2) -> (ToSqlite3Insert, 1)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (run, 0) -> (runLeader, 0) -> (leaderLoop, 0) -> (checkLeaderLease, 0) -> (initializeInstanceDao, 0)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Read, 1) -> (decode, 1) -> (decMapInt64Intf, 1) -> (readMapLen, 0) -> (NewNetworkTransport, 4) -> (NewNetworkTransportWithLogger, 4)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Read, 1) -> (decode, 1) -> (decMapInt64Intf, 1) -> (readMapLen, 0) -> (init, 0) -> (newSeed, 0)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (Exec, 1) -> (exec, 2)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (GetClusterName, 1) -> (GetString, 1) -> (OpenOrchestrator, 0) -> (Infof, 5) -> (ExecOrchestrator, 1)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (run, 0) -> (runLeader, 0) -> (leaderLoop, 0) -> (checkLeaderLease, 0)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Next, 0) -> (Fatalf, 3) -> (runLeader, 0) -> (leaderLoop, 0) -> (init, 0)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (run, 0) -> (runLeader, 0) -> (leaderLoop, 0) -> (checkLeaderLease, 0) -> (MarkConfigurationLoaded, 0)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Next, 0) -> (Fatalf, 3) -> (runLeader, 0) -> (leaderLoop, 0) -> (replicate, 1) -> (pipelineReplicate, 1) -> (pipelineSend, 4) -> (AppendEntries, 2)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (read, 1) -> (Fatale, 1) -> (Exit, 1) -> (readInto, 4) -> (MarkConfigurationLoaded, 0)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (read, 1) -> (Fatale, 1) -> (Exit, 1) -> (readInto, 4) -> (WithDeadline, 2) -> (cancel, 2)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Read, 1) -> (decode, 1) -> (decMapInt64Intf, 1) -> (readMapLen, 0) -> (WithTimeout, 2) -> (WithDeadline, 2) -> (cancel, 2)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Read, 1) -> (decode, 1) -> (decMapInt64Intf, 1) -> (readMapLen, 0) -> (restoreSnapshot, 0) -> (setLastSnapshot, 2) -> (NewDecoder, 2) -> (newDecDriver, 1) -> (ExecOrchestrator, 2) -> (mkInsertOdku, 5) -> (ToJSON, 0)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (New, 2) -> (newCacheWithJanitor, 3) -> (runJanitor, 2)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (read, 1) -> (Fatale, 1) -> (Exit, 1) -> (readInto, 4)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (read, 1) -> (Fatale, 1) -> (Exit, 1) -> (readInto, 4) -> (NewNetworkTransportWithLogger, 4)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (New, 2)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Read, 1) -> (decode, 1) -> (decMapInt64Intf, 1) -> (readMapLen, 0) -> (init, 0)
(ForgetInstance, 1) -> (Errorf, 2) -> (logFormattedEntry, 3) -> (Debug, 1) -> (Next, 0) -> (Fatalf, 3) -> (runLeader, 0) -> (leaderLoop, 0) -> (GetInState, 1) -> (Printf, 8)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (read, 1) -> (Fatale, 1) -> (Exit, 1) -> (readInto, 4) -> (NewNetworkTransportWithLogger, 4) -> (listen, 0)
(ForgetInstance, 1) -> (AuditOperation, 3) -> (, 0) -> (AddVals, 1) -> (read, 1) -> (Fatale, 1) -> (Exit, 1) -> (readInto, 4) -> (Restore, 1) -> (NewDecoder, 2) -> (getBasicHandle, 0) -> (ExecOrchestrator, 2) -> (mkInsertOdku, 5) -> (ToJSON, 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: 41fdb4756dfc15ef99d3ef6ee21be8335eae5528
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.