github-vet / github-vet/rangeloop-pointer-findings
litmuschaos/chaos-exporter: controller/scrape.go; 16 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [litmuschaos/chaos-exporter](https://www.github.com/litmuschaos/chaos-exporter) at [controller/scrape.go](https://github.com/litmuschaos/chaos-exporter/blob/bb8404698f8176b34dc445e612f16d09efcc6a59/controller/scrape.go#L55-L70)
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 chaosEngine at line 68 may start a goroutine
[Click here to see the code in its original context.](https://github.com/litmuschaos/chaos-exporter/blob/bb8404698f8176b34dc445e612f16d09efcc6a59/controller/scrape.go#L55-L70)
Click here to show the 16 line(s) of Go which triggered the analyzer.
```go
for _, chaosEngine := range filteredChaosEngineList.Items {
totalEngine, passedEngine, failedEngine, awaitedEngine := getExperimentMetricsFromEngine(&chaosEngine)
klog.V(0).Infof("ChaosEngineMetrics: EngineName: %v, EngineNamespace: %v, TotalExp: %v, PassedExp: %v, FailedExp: %v, TotalRunningExp: %v", chaosEngine.Name, chaosEngine.Namespace, totalEngine, passedEngine, failedEngine, len(experimentStatusMap))
var engineDetails ChaosEngineDetail
engineDetails.Name = chaosEngine.Name
engineDetails.Namespace = chaosEngine.Namespace
engineDetails.TotalExp = totalEngine
engineDetails.PassedExp = passedEngine
engineDetails.FailedExp = failedEngine
engineDetails.AwaitedExp = awaitedEngine
total += totalEngine
pass += passedEngine
fail += failedEngine
setEngineChaosMetrics(engineDetails, &chaosEngine)
setAwsEngineChaosMetrics(engineDetails, &chaosEngine)
}
```
Click here to show extra information the analyzer produced.
```
The following paths through the callgraph could lead to a goroutine:
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (parse, 0) -> (consume, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (String, 0) -> (WriteRune, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Get, 1) -> (extensionMap, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Parse, 1) -> (parseText, 1) -> (next, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Parse, 1) -> (parseText, 1) -> (next, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (parse, 0) -> (consume, 1) -> (consume, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (parse, 0) -> (consume, 1) -> (consume, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Get, 1) -> (extensionMap, 1) -> (ExtensionRanges, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (printf, 3)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (Write, 1) -> (printWithFileLine, 5) -> (output, 5) -> (AddInt64, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (parse, 0) -> (consume, 1) -> (consume, 2) -> (take, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Get, 1) -> (extensionMap, 1) -> (ExtensionRanges, 0) -> (has, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (printf, 3) -> (header, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (timeoutFlush, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (Describe, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (handleResponse, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (StartInterceptingOutput, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (on100, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (startFrameWrite, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (startFrameWrite, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (Describe, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (handleResponse, 2) -> (awaitRequestCancel, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (scheduleFrameWrite, 0) -> (isControl, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (scheduleFrameWrite, 0) -> (isControl, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (SpecSuiteWillBegin, 2) -> (escape, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (BeforeSuiteDidRun, 1) -> (handleSetupSummary, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (SpecDidComplete, 1) -> (failureDetails, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (AfterSuiteDidRun, 1) -> (handleSetupSummary, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (StartInterceptingOutput, 0) -> (TailFile, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (SpecSuiteWillBegin, 2) -> (escape, 1) -> (printNewLine, 0)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (BeforeSuiteDidRun, 1) -> (handleSetupSummary, 2) -> (failureDetails, 1)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (SpecDidComplete, 1) -> (failureDetails, 1) -> (printSpecFailure, 4)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (AfterSuiteDidRun, 1) -> (handleSetupSummary, 2) -> (announceSetupFailure, 4)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (printf, 3) -> (header, 2) -> (run, 3) -> (addConnLocked, 2) -> (newClientConn, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (StartInterceptingOutput, 0) -> (TailFile, 2) -> (tailFileSync, 0) -> (waitForChanges, 0) -> (ChangeEvents, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (SpecSuiteWillBegin, 2) -> (escape, 1) -> (printNewLine, 0) -> (indent, 3) -> (waitForChanges, 0) -> (ChangeEvents, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (BeforeSuiteDidRun, 1) -> (handleSetupSummary, 2) -> (failureDetails, 1) -> (endBlock, 0) -> (printDelimiter, 0) -> (ChangeEvents, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (SpecDidComplete, 1) -> (failureDetails, 1) -> (printSpecFailure, 4) -> (printFailure, 4) -> (waitForChanges, 0) -> (ChangeEvents, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (AfterSuiteDidRun, 1) -> (handleSetupSummary, 2) -> (announceSetupFailure, 4) -> (printFailure, 4) -> (waitForChanges, 0) -> (ChangeEvents, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (StartInterceptingOutput, 0) -> (TailFile, 2) -> (tailFileSync, 0) -> (waitForChanges, 0) -> (ChangeEvents, 2) -> (ModTime, 0) -> (sendOnlyIfEmpty, 1) -> (NewFrameReader, 1) -> (NewStreamWatcher, 2)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (SpecSuiteWillBegin, 2) -> (escape, 1) -> (printNewLine, 0) -> (indent, 3) -> (waitForChanges, 0) -> (ChangeEvents, 2) -> (ModTime, 0) -> (sendOnlyIfEmpty, 1) -> (WatchWithSpecificDecoders, 2) -> (NewClientErrorReporter, 3)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (BeforeSuiteDidRun, 1) -> (handleSetupSummary, 2) -> (failureDetails, 1) -> (endBlock, 0) -> (printDelimiter, 0) -> (ChangeEvents, 2) -> (ModTime, 0) -> (sendOnlyIfEmpty, 1) -> (WatchWithSpecificDecoders, 2) -> (NewClientErrorReporter, 3)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (SpecDidComplete, 1) -> (failureDetails, 1) -> (printSpecFailure, 4) -> (printFailure, 4) -> (waitForChanges, 0) -> (ChangeEvents, 2) -> (ModTime, 0) -> (sendOnlyIfEmpty, 1) -> (WatchWithSpecificDecoders, 2) -> (NewClientErrorReporter, 3)
(setEngineChaosMetrics, 2) -> (Set, 1) -> (readAsCSV, 1) -> (Read, 0) -> (, 0) -> (Base, 1) -> (GetCurrentProcessId, 0) -> (Syscall, 5) -> (AfterSuiteDidRun, 1) -> (handleSetupSummary, 2) -> (announceSetupFailure, 4) -> (printFailure, 4) -> (waitForChanges, 0) -> (ChangeEvents, 2) -> (ModTime, 0) -> (sendOnlyIfEmpty, 1) -> (WatchWithSpecificDecoders, 2) -> (NewClientErrorReporter, 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: bb8404698f8176b34dc445e612f16d09efcc6a59
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.