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

litmuschaos/litmus-go: pkg/result/chaosresult.go; 12 LoC

Open
#6,797 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [litmuschaos/litmus-go](https://www.github.com/litmuschaos/litmus-go) at [pkg/result/chaosresult.go](https://github.com/litmuschaos/litmus-go/blob/bcdcf88315cd76c0b366fd4dc902db36f1ac7a91/pkg/result/chaosresult.go#L59-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 result at line 64 may start a goroutine

[Click here to see the code in its original context.](https://github.com/litmuschaos/litmus-go/blob/bcdcf88315cd76c0b366fd4dc902db36f1ac7a91/pkg/result/chaosresult.go#L59-L70)

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

```go
for _, result := range resultList.Items {

// the chaos-result is already present with matching labels
// it will patch the new parameters in the same chaos-result
if state == "SOT" {
return PatchChaosResult(&result, clients, chaosDetails, resultDetails, experimentLabel)
}

// it will patch the chaos-result in the end of experiment
resultDetails.Phase = "Completed"
return PatchChaosResult(&result, clients, chaosDetails, resultDetails, experimentLabel)
}

```

Click here to show extra information the analyzer produced.

```
The following paths through the callgraph could lead to a goroutine:
(PatchChaosResult, 5) -> (Wait, 1) -> (WaitN, 2) -> (Cancel, 0) -> (Close, 0)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Close, 0)
(PatchChaosResult, 5) -> (Update, 1) -> (Do, 0) -> (transformResponse, 2) -> (Close, 0)
(PatchChaosResult, 5) -> (Update, 1) -> (Body, 1) -> (SetHeader, 2) -> (Close, 0)
(PatchChaosResult, 5) -> (Errorf, 2) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Close, 0)
(PatchChaosResult, 5) -> (Errorf, 2) -> (printf, 3) -> (output, 5) -> (timeoutFlush, 1)
(PatchChaosResult, 5) -> (Wait, 1) -> (WaitN, 2) -> (Cancel, 0) -> (Close, 0) -> (onClose, 0)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Close, 0) -> (onClose, 0)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Start, 2) -> (connect, 1)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (parse, 0) -> (consume, 1)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Get, 1) -> (extensionMap, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Into, 1) -> (FromObject, 1) -> (Has, 1) -> (extensionMap, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Into, 1) -> (FromObject, 1) -> (Decode, 2) -> (cap, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Into, 1) -> (FromObject, 1) -> (RecognizesData, 1) -> (NewBuffer, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Do, 0) -> (transformResponse, 2) -> (Close, 0) -> (onClose, 0)
(PatchChaosResult, 5) -> (Update, 1) -> (Do, 0) -> (transformResponse, 2) -> (Get, 1) -> (extensionMap, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Body, 1) -> (SetHeader, 2) -> (NewEncoder, 1) -> (newEncoderWithWriter, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Body, 1) -> (SetHeader, 2) -> (Close, 0) -> (onClose, 0)
(PatchChaosResult, 5) -> (Errorf, 2) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Close, 0) -> (onClose, 0)
(PatchChaosResult, 5) -> (Errorf, 2) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Start, 2) -> (connect, 1)
(PatchChaosResult, 5) -> (Errorf, 2) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (parse, 0) -> (consume, 1)
(PatchChaosResult, 5) -> (Errorf, 2) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Get, 1) -> (extensionMap, 1)
(PatchChaosResult, 5) -> (Errorf, 2) -> (printf, 3) -> (output, 5) -> (Decode, 2) -> (cap, 1)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Parse, 1) -> (FromInt, 1) -> (Stack, 0)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Bytes, 0) -> (LoadInt64, 1) -> (typeName, 0)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Decode, 3) -> (ToJSON, 1) -> (hasJSONPrefix, 1)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Decode, 3) -> (ToJSON, 1) -> (hasJSONPrefix, 1)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Bytes, 0) -> (LoadInt64, 1) -> (typeName, 0)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2)
(PatchChaosResult, 5) -> (Update, 1) -> (Into, 1) -> (FromObject, 1) -> (Decode, 3) -> (ToJSON, 1) -> (hasJSONPrefix, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Into, 1) -> (FromObject, 1) -> (Decode, 3) -> (ToJSON, 1) -> (hasJSONPrefix, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Do, 0) -> (transformResponse, 2) -> (, 0) -> (Unmarshaler, 1) -> (GetCurrentProcessId, 0)
(PatchChaosResult, 5) -> (Update, 1) -> (Do, 0) -> (transformResponse, 2) -> (WithTimeout, 2) -> (WithDeadline, 2) -> (AfterFunc, 2)
(PatchChaosResult, 5) -> (Errorf, 2) -> (WithFields, 1) -> (releaseEntry, 1) -> (Get, 0) -> (Version, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (Errorf, 2) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2)
(PatchChaosResult, 5) -> (Errorf, 2) -> (compile, 1) -> (String, 0) -> (Get, 0) -> (Version, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (Errorf, 2) -> (Logf, 3) -> (releaseEntry, 1) -> (Get, 0) -> (Version, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (Errorf, 2) -> (printf, 3) -> (output, 5) -> (Get, 0) -> (Version, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (SetProbeVerdictAfterFailure, 1) -> (Sprint, 1) -> (compile, 1) -> (String, 0) -> (Get, 0) -> (Version, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Len, 0) -> (Get, 0) -> (Version, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (String, 0) -> (Get, 0) -> (Version, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (Len, 0) -> (Get, 0) -> (Version, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3)
(PatchChaosResult, 5) -> (Update, 1) -> (Into, 1) -> (FromObject, 1) -> (String, 0) -> (Get, 0) -> (Version, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Into, 1) -> (FromObject, 1) -> (newEvent, 2) -> (AppendObjectData, 2) -> (AppendKey, 2) -> (AppendVarint, 2)
(PatchChaosResult, 5) -> (Update, 1) -> (Do, 0) -> (transformResponse, 2) -> (String, 0) -> (Get, 0) -> (Version, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Do, 0) -> (transformResponse, 2) -> (, 0) -> (Unmarshaler, 1) -> (GetCurrentProcessId, 0) -> (register, 3)
(PatchChaosResult, 5) -> (Update, 1) -> (Do, 0) -> (transformResponse, 2) -> (, 0) -> (Unmarshaler, 1) -> (GetCurrentProcessId, 0) -> (register, 3)
(PatchChaosResult, 5) -> (Update, 1) -> (Do, 0) -> (transformResponse, 2) -> (String, 0) -> (Get, 0) -> (Retrieve, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Do, 0) -> (transformResponse, 2) -> (WithTimeout, 2) -> (WithDeadline, 2) -> (AfterFunc, 2) -> (removeChild, 2)
(PatchChaosResult, 5) -> (Update, 1) -> (Body, 1) -> (SetHeader, 2) -> (Len, 0) -> (Get, 0) -> (Retrieve, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Body, 1) -> (SetHeader, 2) -> (BorrowStream, 1) -> (Reset, 1) -> (resetMessage, 1) -> (SetUnknown, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Body, 1) -> (SetHeader, 2) -> (BorrowIterator, 1) -> (ResetBytes, 1) -> (Retrieve, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (Update, 1) -> (Body, 1) -> (SetHeader, 2) -> (Write, 1) -> (severity, 1) -> (flushAll, 0) -> (Sync, 0)
(PatchChaosResult, 5) -> (Update, 1) -> (Body, 1) -> (SetHeader, 2) -> (String, 0) -> (Get, 0) -> (Retrieve, 0) -> (AssumeRole, 1)
(PatchChaosResult, 5) -> (Errorf, 2) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3) -> (run, 3) -> (addConnLocked, 2) -> (disableKeepAlives, 0)
(PatchChaosResult, 5) -> (Errorf, 2) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3) -> (run, 3) -> (addConnLocked, 2) -> (disableKeepAlives, 0)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3) -> (run, 3) -> (addConnLocked, 2) -> (disableKeepAlives, 0) -> (readLoop, 0) -> (WriteGoAway, 3) -> (writeBytes, 1)
(PatchChaosResult, 5) -> (Errorf, 2) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3) -> (run, 3) -> (addConnLocked, 2) -> (disableKeepAlives, 0) -> (readLoop, 0) -> (WriteGoAway, 3) -> (writeBytes, 1)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3) -> (run, 3) -> (addConnLocked, 2) -> (disableKeepAlives, 0) -> (readLoop, 0) -> (WriteGoAway, 3) -> (writeBytes, 1) -> (in, 6)
(PatchChaosResult, 5) -> (Errorf, 2) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3) -> (run, 3) -> (addConnLocked, 2) -> (disableKeepAlives, 0) -> (readLoop, 0) -> (WriteGoAway, 3) -> (writeBytes, 1) -> (in, 6)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3) -> (run, 3) -> (addConnLocked, 2) -> (disableKeepAlives, 0) -> (readLoop, 0) -> (WriteGoAway, 3) -> (writeBytes, 1) -> (in, 6) -> (assignBracketType, 3)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3) -> (run, 3) -> (addConnLocked, 2) -> (disableKeepAlives, 0) -> (readLoop, 0) -> (WriteGoAway, 3) -> (writeBytes, 1) -> (in, 6) -> (assignBracketType, 3)
(PatchChaosResult, 5) -> (Wait, 1) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3) -> (run, 3) -> (addConnLocked, 2) -> (disableKeepAlives, 0) -> (readLoop, 0) -> (WriteGoAway, 3) -> (writeBytes, 1) -> (in, 6) -> (assignBracketType, 3)
(PatchChaosResult, 5) -> (Errorf, 2) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3) -> (run, 3) -> (addConnLocked, 2) -> (disableKeepAlives, 0) -> (readLoop, 0) -> (WriteGoAway, 3) -> (writeBytes, 1) -> (in, 6) -> (assignBracketType, 3)
(PatchChaosResult, 5) -> (Errorf, 2) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3) -> (run, 3) -> (addConnLocked, 2) -> (disableKeepAlives, 0) -> (readLoop, 0) -> (WriteGoAway, 3) -> (writeBytes, 1) -> (in, 6) -> (assignBracketType, 3)
(PatchChaosResult, 5) -> (Errorf, 2) -> (New, 1) -> (HTTPWrappersForConfig, 2) -> (SetTransportDefaults, 1) -> (Warningf, 2) -> (Warnf, 2) -> (addConnIfNeeded, 3) -> (run, 3) -> (addConnLocked, 2) -> (disableKeepAlives, 0) -> (readLoop, 0) -> (WriteGoAway, 3) -> (writeBytes, 1) -> (in, 6) -> (assignBracketType, 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: bcdcf88315cd76c0b366fd4dc902db36f1ac7a91

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.