github-vet / github-vet/rangeloop-pointer-findings
evergreen-ci/evergreen: units/task_stranded_cleanup.go; 10 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [evergreen-ci/evergreen](https://www.github.com/evergreen-ci/evergreen) at [units/task_stranded_cleanup.go](https://github.com/evergreen-ci/evergreen/blob/a30fb318ff554bfa7becbbbc3d5ad63e356be156/units/task_stranded_cleanup.go#L67-L76)
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 75 may start a goroutine
[Click here to see the code in its original context.](https://github.com/evergreen-ci/evergreen/blob/a30fb318ff554bfa7becbbbc3d5ad63e356be156/units/task_stranded_cleanup.go#L67-L76)
Click here to show the 10 line(s) of Go which triggered the analyzer.
```go
for _, h := range hosts {
if h.RunningTask == "" {
continue
}
taskIDs = append(taskIDs, h.RunningTask)
hostIDs = append(hostIDs, h.Id)
j.AddError(model.ClearAndResetStrandedTask(&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 {
"(run, 4)" -> {"(Import, 1)";"(Create, 2)";"(Interpret, 5)";}
"(Add, 1)" -> {"(Push, 2)";"(Search, 2)";"(Insert, 2)";"(Load, 1)";"(Open, 1)";"(Put, 1)";}
"(SetUpTest, 1)" -> {}
"(UploadPack, 2)" -> {}
"(updateHealthMonitor, 1)" -> {"(monitor, 4)";}
"(pushHashes, 5)" -> {}
"(Put, 1)" -> {"(Create, 1)";"(Remove, 1)";}
"(Unmarshal, 2)" -> {"(Set, 1)";"(Put, 1)";"(Decode, 1)";}
"(Upgrade, 7)" -> {"(pull, 4)";}
"(WatchFrom, 3)" -> {}
"(handleNodeConflict, 2)" -> {}
"(containerStart, 4)" -> {"(initHealthMonitor, 1)";}
"(UpdateTaskStatus, 3)" -> {}
"(callSSA, 6)" -> {"(runFrame, 1)";}
"(fixImports, 3)" -> {}
"(Run, 2)" -> {"(SetUpTest, 1)";"(serve, 3)";"(Update, 4)";"(Watch, 2)";"(worker, 3)";"(Solve, 2)";"(TearDownSuite, 1)";"(SetUpSuite, 1)";}
"(allPackages, 3)" -> {}
"(Search, 1)" -> {"(Execute, 2)";}
"(New, 3)" -> {"(newOracle, 4)";"(Pull, 1)";"(configureTLS, 4)";"(Release, 1)";}
"(NewProcess, 2)" -> {"(newBlockingProcess, 2)";"(newBasicProcess, 2)";}
"(runAgent, 4)" -> {}
"(Open, 1)" -> {"(start, 2)";}
"(RunJasperProcess, 3)" -> {"(CreateProcess, 2)";}
"(ServeHTTP, 2)" -> {"(serveBiDirectionalStream, 2)";"(Do, 3)";"(handleLock, 2)";"(ServeHTTP, 3)";"(applyTemplate, 3)";}
"(NewDaemon, 3)" -> {}
"(newBasicProcess, 2)" -> {}
"(Spec, 1)" -> {"(FromURL, 2)";}
"(applyTemplate, 3)" -> {"(Execute, 2)";}
"(sendTestLogs, 5)" -> {"(sendTestLog, 4)";}
"(superviseManager, 5)" -> {"(runManager, 5)";}
"(sendTestLog, 4)" -> {"(sendTestLogToCedar, 4)";}
"(DelayStart, 6)" -> {}
"(Get, 1)" -> {"(Add, 2)";"(Open, 1)";"(Get, 2)";"(Remove, 1)";"(Get, 0)";"(get, 1)";"(doRequest, 2)";"(Decode, 1)";"(ServeHTTP, 2)";"(Load, 1)";"(Do, 2)";"(Get, 3)";}
"(CreateNode, 1)" -> {"(Send, 0)";}
"(SetUpSuite, 1)" -> {"(WaitUntilStatus, 2)";"(SetUpTest, 1)";}
"(Walk, 2)" -> {"(List, 2)";}
"(Init, 0)" -> {"(Get, 0)";"(run, 3)";"(Add, 1)";}
"(Insert, 2)" -> {"(insert, 4)";}
"(release, 1)" -> {"(Remove, 2)";}
"(handleControlSocketChange, 2)" -> {}
"(ForEachPackage, 2)" -> {"(allPackages, 3)";"(allPackages, 4)";}
"(WriteMessage, 1)" -> {"(Write, 1)";}
"(Execute, 2)" -> {"(Decrypt, 2)";}
"(copyPipes, 7)" -> {}
"(Update, 1)" -> {"(ConcurrentUpdate, 4)";}
"(append, 1)" -> {}
"(newStdioPipes, 1)" -> {"(ListenPipe, 2)";}
"(newBlockingProcess, 2)" -> {}
"(monitor, 4)" -> {}
"(Load, 2)" -> {"(Get, 1)";"(Unmarshal, 2)";"(Release, 1)";"(load, 2)";"(newVertex, 5)";"(remoteID, 1)";"(Load, 1)";}
"(Copy, 2)" -> {"(Create, 1)";"(copyPipes, 7)";}
"(reconcileTaskState, 4)" -> {}
"(initializeSubsystem, 3)" -> {"(Create, 2)";}
"(loadListeners, 2)" -> {"(Init, 4)";}
"(NewSigner, 4)" -> {"(New, 2)";}
"(Encode, 1)" -> {"(Copy, 2)";"(Write, 1)";}
"(newSession, 3)" -> {"(initHandlers, 1)";}
"(parsePackageFiles, 2)" -> {"(parseFiles, 6)";}
"(WriteLogEntry, 1)" -> {"(Write, 1)";}
"(Set, 1)" -> {"(Search, 2)";}
"(startTask, 3)" -> {"(runPreTaskCommands, 2)";"(runTaskCommands, 2)";"(taskManager, 3)";"(logStats, 2)";}
"(TryDialWithAddr, 2)" -> {"(NewClientConn, 3)";}
"(newLeaseUpdater, 3)" -> {}
"(NewSnapshotter, 8)" -> {}
"(Start, 1)" -> {"(start, 1)";"(CopyConsole, 6)";"(worker, 4)";}
"(configureTLS, 4)" -> {}
"(CopyConsole, 6)" -> {}
"(Init, 4)" -> {"(ListenPipe, 2)";}
"(remoteID, 1)" -> {"(Write, 1)";}
"(parseAndUploadResults, 4)" -> {"(sendTestLog, 4)";}
"(UpdateCachedTask, 2)" -> {"(New, 1)";}
"(fixImports, 2)" -> {}
"(fetch, 2)" -> {"(fetchPack, 4)";}
"(Solve, 3)" -> {"(Exec, 6)";}
"(remove, 1)" -> {"(Remove, 2)";}
"(Do, 3)" -> {"(Start, 1)";"(Prepare, 1)";}
"(insert, 4)" -> {}
"(WaitForCluster, 2)" -> {"(Watch, 2)";}
"(Walk, 3)" -> {"(Push, 1)";}
"(Verify, 3)" -> {"(verify, 3)";}
"(NewServer, 1)" -> {"(newServer, 2)";}
"(Run, 1)" -> {"(wait, 1)";"(Run, 2)";"(ViewAndWatch, 3)";"(WaitForCluster, 2)";"(stop, 1)";"(GetDockerLogs, 5)";"(StartJasperProcess, 3)";"(RunJasperProcess, 3)";"(UpdateNode, 1)";"(Execute, 2)";}
"(wait, 1)" -> {}
"(NewClient, 2)" -> {"(Apply, 1)";"(NewClient, 1)";"(Parse, 1)";}
"(Build, 1)" -> {"(ForEachPackage, 2)";}
"(GetDockerLogs, 4)" -> {"(ContainerLogs, 3)";}
"(ViewAndWatch, 3)" -> {"(Watch, 2)";}
"(UpdateNode, 1)" -> {"(aliveNode, 3)";}
"(TryDial, 1)" -> {"(TryDialWithAddr, 2)";}
"(newClientTransport, 6)" -> {}
"(pullSchema2, 4)" -> {"(pullSchema2Layers, 4)";}
"(apply, 2)" -> {"(Apply, 2)";"(Update, 2)";"(Remove, 1)";}
"(PushContext, 2)" -> {"(pushHashes, 5)";}
"(executeOneFile, 5)" -> {"(sendTestLog, 4)";}
"(Write, 1)" -> {"(Copy, 2)";"(write, 3)";}
"(useExistingTask, 3)" -> {"(DelayStart, 6)";}
"(load, 1)" -> {"(parsePackageFiles, 2)";}
"(Release, 1)" -> {"(Remove, 1)";"(release, 1)";"(Update, 1)";}
"(NewServerConn, 2)" -> {"(serverHandshake, 1)";}
"(pullV2Repository, 3)" -> {"(pullV2Tag, 3)";}
"(pullOCI, 4)" -> {"(pullSchema2Layers, 4)";}
"(Remove, 1)" -> {"(Remove, 2)";"(Close, 1)";"(Search, 2)";"(Search, 1)";}
"(roundTrip, 1)" -> {"(awaitOpenSlotForRequest, 1)";}
"(NotifyConflict, 2)" -> {"(handleNodeConflict, 2)";}
"(Execute, 4)" -> {"(sendTestLogsAndResults, 6)";"(sendTestLogs, 5)";"(parseAndUploadResults, 4)";"(executeOneFile, 5)";}
"(build, 1)" -> {"(Open, 1)";"(openNewMongoGroupDriver, 5)";"(openNewMongoDriver, 4)";}
"(ConcurrentUpdate, 4)" -> {}
"(ContainerStart, 4)" -> {"(containerStart, 4)";}
"(serveBiDirectionalStream, 2)" -> {}
"(Exec, 6)" -> {}
"(Dial, 1)" -> {"(TryDial, 1)";}
"(Decrypt, 1)" -> {"(Open, 4)";}
"(Apply, 2)" -> {"(Update, 1)";"(Run, 2)";}
"(New, 5)" -> {"(NewClient, 5)";}
"(logStats, 2)" -> {}
"(runCommandSet, 7)" -> {"(Execute, 4)";}
"(New, 1)" -> {"(Get, 2)";"(Get, 0)";"(newV2Client, 4)";"(Marshal, 1)";"(Unmarshal, 2)";"(Add, 1)";"(build, 1)";"(Ping, 1)";"(New, 5)";"(NewServer, 1)";"(Load, 2)";"(Read, 2)";"(NewClient, 2)";"(run, 1)";"(verifySplunkConnection, 1)";"(CreateNode, 1)";"(parseAddress, 1)";"(New, 2)";"(Init, 0)";"(Join, 2)";"(enableCSM, 3)";"(Open, 1)";"(apply, 2)";"(Parse, 1)";"(newSession, 3)";"(NewSigner, 4)";"(Sign, 1)";"(New, 3)";"(Get, 1)";"(Log, 1)";}
"(call, 5)" -> {"(callSSA, 6)";}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(SetReference, 1)" -> {}
"(parseAddress, 1)" -> {"(Parse, 1)";}
"(newSession, 5)" -> {}
"(TearDownSuite, 1)" -> {}
"(pull, 4)" -> {"(Pull, 3)";}
"(updateTask, 4)" -> {"(DelayStart, 6)";}
"(NewLoggerWithContext, 4)" -> {"(MakeLoggerWithContext, 3)";}
"(Ping, 1)" -> {"(Get, 3)";"(doRequest, 2)";}
"(NewClient, 1)" -> {"(NewClient, 3)";}
"(Prune, 3)" -> {"(Process, 3)";}
"(ServeHTTP, 3)" -> {"(Execute, 2)";}
"(newMemberlist, 1)" -> {"(NewNetTransport, 1)";}
"(PullContext, 2)" -> {"(fetch, 2)";}
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(Load, 1)" -> {"(Create, 1)";}
"(newSerfQueries, 4)" -> {}
"(write, 3)" -> {"(Prune, 3)";}
"(Find, 1)" -> {"(Copy, 2)";"(Load, 1)";}
"(start, 2)" -> {}
"(Update, 2)" -> {"(reconcileTaskState, 4)";"(Create, 2)";"(Update, 1)";}
"(fetchPack, 4)" -> {"(UploadPack, 2)";}
"(worker, 3)" -> {"(useExistingTask, 3)";"(updateTask, 4)";}
"(StartJasperProcess, 3)" -> {"(CreateProcess, 2)";}
"(Verify, 2)" -> {"(Verify, 3)";}
"(Start, 2)" -> {"(Start, 1)";}
"(newOracle, 4)" -> {"(Create, 2)";}
"(awaitOpenSlotForRequest, 1)" -> {}
"(Solve, 2)" -> {"(Solve, 3)";}
"(run, 1)" -> {"(Start, 1)";"(Init, 1)";"(Write, 1)";"(Set, 1)";"(send, 3)";"(newSession, 5)";"(Update, 2)";"(Do, 3)";"(Dial, 1)";"(Subscribe, 2)";"(UpdateTaskStatus, 3)";"(UpdateRootCA, 1)";"(superviseManager, 5)";"(runAgent, 4)";"(Add, 1)";"(run, 4)";}
"(handleLock, 2)" -> {"(Create, 2)";}
"(Apply, 1)" -> {"(Remove, 1)";}
"(Get, 3)" -> {"(Do, 2)";"(Do, 3)";}
"(stop, 1)" -> {}
"(Process, 3)" -> {"(fixImports, 3)";"(fixImports, 2)";}
"(newDirectIO, 2)" -> {"(newStdioPipes, 1)";}
"(send, 3)" -> {}
"(Add, 2)" -> {"(Do, 2)";"(Remove, 1)";"(Push, 2)";"(Spec, 1)";}
"(Prepare, 1)" -> {"(Upgrade, 7)";"(Pull, 8)";}
"(pullSchema2Layers, 4)" -> {}
"(openNewMongoGroupDriver, 5)" -> {"(start, 2)";}
"(newServerTransport, 4)" -> {}
"(Get, 0)" -> {"(Do, 2)";"(remove, 1)";"(run, 4)";}
"(Pull, 8)" -> {"(pull, 4)";}
"(Pull, 1)" -> {"(PullContext, 2)";}
"(verify, 3)" -> {"(fulfill, 3)";}
"(MakeLoggerWithContext, 3)" -> {}
"(Get, 2)" -> {"(Start, 1)";"(Do, 2)";"(implements, 1)";"(openNewMongoGroupDriver, 5)";"(Do, 3)";"(get, 1)";"(New, 2)";}
"(serve, 3)" -> {}
"(checkResetDisplayTask, 1)" -> {"(Find, 1)";}
"(Sign, 1)" -> {"(New, 2)";"(Send, 0)";"(New, 3)";"(Decode, 1)";}
"(run, 3)" -> {"(start, 2)";}
"(Remove, 2)" -> {"(SetReference, 1)";}
"(newVertex, 5)" -> {"(load, 1)";}
"(serverAuthenticate, 1)" -> {"(Verify, 2)";}
"(ClearAndResetStrandedTask, 1)" -> {"(New, 1)";"(UpdateCachedTask, 2)";"(checkResetDisplayTask, 1)";}
"(initHandlers, 1)" -> {"(Remove, 1)";}
"(shutdownDaemon, 1)" -> {}
"(doRequest, 2)" -> {"(Do, 3)";}
"(FromURL, 2)" -> {"(Dial, 3)";}
"(Subscribe, 2)" -> {"(Close, 1)";}
"(enableCSM, 3)" -> {"(Start, 2)";}
"(allPackages, 4)" -> {}
"(runPreTaskCommands, 2)" -> {"(runCommands, 4)";}
"(RoundTrip, 1)" -> {"(start, 1)";"(roundTrip, 1)";"(RoundTripOpt, 2)";}
"(Read, 2)" -> {"(Put, 1)";}
"(get, 1)" -> {"(load, 1)";}
"(RoundTripOpt, 2)" -> {"(roundTrip, 1)";}
"(Interpret, 5)" -> {"(call, 5)";}
"(Open, 4)" -> {"(Verify, 3)";}
"(New, 2)" -> {"(initializeSubsystem, 3)";"(load, 1)";"(Update, 1)";"(Init, 2)";}
"(CreateProcess, 2)" -> {"(NewProcess, 2)";}
"(runFrame, 1)" -> {"(visitInstr, 2)";}
"(Close, 1)" -> {"(List, 2)";}
"(pullV2Tag, 3)" -> {"(pullSchema2, 4)";"(pullOCI, 4)";}
"(WaitUntilStatus, 2)" -> {}
"(NewClient, 5)" -> {}
"(implements, 1)" -> {"(Build, 1)";}
"(Log, 1)" -> {"(WriteMessage, 1)";"(WriteLogEntry, 1)";"(Encode, 1)";"(Add, 2)";"(Write, 1)";}
"(Create, 2)" -> {"(append, 1)";"(createIO, 5)";"(CopyConsole, 6)";"(CreateProcess, 2)";}
"(runCommands, 4)" -> {"(runCommandSet, 7)";}
"(Exec, 4)" -> {"(Exec, 2)";}
"(newV2Client, 4)" -> {}
"(Send, 0)" -> {"(Remove, 1)";"(Run, 1)";}
"(load, 2)" -> {"(Insert, 2)";}
"(createIO, 5)" -> {"(newDirectIO, 2)";}
"(parseFiles, 6)" -> {}
"(ListenPipe, 2)" -> {}
"(Exec, 2)" -> {"(Solve, 3)";}
"(verifySplunkConnection, 1)" -> {"(Copy, 2)";}
"(Parse, 1)" -> {"(Decode, 1)";"(Open, 1)";"(Walk, 2)";}
"(GetDockerLogs, 5)" -> {"(GetDockerLogs, 4)";}
"(Init, 2)" -> {"(SetReference, 1)";}
"(Import, 1)" -> {"(newLeaseUpdater, 3)";}
"(newTaskManager, 3)" -> {"(newTaskManager, 4)";}
"(List, 2)" -> {"(Walk, 3)";}
"(Marshal, 1)" -> {"(Put, 1)";"(Encode, 1)";"(Get, 1)";"(Get, 0)";}
"(Dial, 3)" -> {"(NewClientConn, 3)";}
"(Search, 2)" -> {"(Execute, 2)";}
"(Decrypt, 2)" -> {"(Open, 4)";"(Decrypt, 1)";}
"(Pull, 3)" -> {"(pullV2Repository, 3)";}
"(taskManager, 3)" -> {"(newTaskManager, 3)";}
"(NewClient, 3)" -> {"(Prepare, 1)";}
"(runManager, 5)" -> {}
"(Push, 2)" -> {"(Remove, 2)";}
"(GetMember, 1)" -> {"(Send, 0)";}
"(Update, 4)" -> {}
"(NewNetTransport, 1)" -> {}
"(ContainerLogs, 3)" -> {}
"(runTaskCommands, 2)" -> {"(runCommands, 4)";}
"(Create, 1)" -> {"(newMemberlist, 1)";"(newSerfQueries, 4)";"(NewSnapshotter, 8)";"(StartTLS, 1)";"(Run, 2)";}
"(serverHandshake, 1)" -> {"(newServerTransport, 4)";"(serverAuthenticate, 1)";}
"(Decode, 1)" -> {"(Close, 1)";}
"(sendTestLogsAndResults, 6)" -> {"(sendTestLog, 4)";}
"(Init, 1)" -> {"(startTask, 3)";"(Update, 1)";}
"(Do, 2)" -> {"(RoundTrip, 1)";}
"(openNewMongoDriver, 4)" -> {"(start, 2)";}
"(Watch, 2)" -> {"(WatchFrom, 3)";}
"(aliveNode, 3)" -> {"(NotifyConflict, 2)";}
"(fulfill, 3)" -> {}
"(UpdateRootCA, 1)" -> {}
"(Join, 2)" -> {"(GetMember, 1)";}
"(initHealthMonitor, 1)" -> {"(updateHealthMonitor, 1)";}
"(Push, 1)" -> {"(PushContext, 2)";}
"(sendTestLogToCedar, 4)" -> {"(NewLoggerWithContext, 4)";}
"(start, 1)" -> {"(shutdownDaemon, 1)";"(handleControlSocketChange, 2)";"(createIO, 5)";"(CopyConsole, 6)";"(loadListeners, 2)";"(ContainerStart, 4)";"(Exec, 4)";"(NewDaemon, 3)";}
"(worker, 4)" -> {}
"(StartTLS, 1)" -> {}
"(newTaskManager, 4)" -> {}
"(visitInstr, 2)" -> {}
"(newServer, 2)" -> {"(NewServerConn, 2)";}
}
```
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: a30fb318ff554bfa7becbbbc3d5ad63e356be156
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.