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

evergreen-ci/evergreen: cloud/ec2_fleet.go; 11 LoC

Open
#9,520 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 [evergreen-ci/evergreen](https://www.github.com/evergreen-ci/evergreen) at [cloud/ec2_fleet.go](https://github.com/evergreen-ci/evergreen/blob/a30fb318ff554bfa7becbbbc3d5ad63e356be156/cloud/ec2_fleet.go#L209-L219)

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 213 may start a goroutine

[Click here to see the code in its original context.](https://github.com/evergreen-ci/evergreen/blob/a30fb318ff554bfa7becbbbc3d5ad63e356be156/cloud/ec2_fleet.go#L209-L219)

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

```go
for _, h := range hosts {
status := ec2StatusToEvergreenStatus(*instanceMap[h.Id].State.Name)
if status == StatusRunning {
// cache instance information so we can make fewer calls to AWS's API
grip.Error(message.WrapError(cacheHostData(ctx, &h, instanceMap[h.Id], m.client), message.Fields{
"message": "can't update host cached data",
"host_id": h.Id,
}))
}
statuses = append(statuses, status)
}

```

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 {
"(NewClient, 2)" -> {"(Apply, 1)";"(NewClient, 1)";"(Parse, 1)";}
"(Execute, 4)" -> {"(sendTestLogs, 5)";"(parseAndUploadResults, 4)";"(executeOneFile, 5)";"(sendTestLogsAndResults, 6)";}
"(ViewAndWatch, 3)" -> {"(Watch, 2)";}
"(WaitForCluster, 2)" -> {"(Watch, 2)";}
"(newStdioPipes, 1)" -> {"(ListenPipe, 2)";}
"(Verify, 2)" -> {"(Verify, 3)";}
"(openNewMongoDriver, 4)" -> {"(start, 2)";}
"(GetMember, 1)" -> {"(Send, 0)";}
"(serve, 3)" -> {}
"(Subscribe, 2)" -> {"(Close, 1)";}
"(Open, 4)" -> {"(Verify, 3)";}
"(allPackages, 4)" -> {}
"(remoteID, 1)" -> {"(Write, 1)";}
"(Log, 1)" -> {"(Write, 1)";"(WriteMessage, 1)";"(WriteLogEntry, 1)";"(Encode, 1)";"(Add, 2)";}
"(Write, 1)" -> {"(write, 3)";"(Copy, 2)";}
"(newOracle, 4)" -> {"(Create, 2)";}
"(sendTestLogToCedar, 4)" -> {"(NewLoggerWithContext, 4)";}
"(superviseManager, 5)" -> {"(runManager, 5)";}
"(Run, 2)" -> {"(TearDownSuite, 1)";"(SetUpSuite, 1)";"(SetUpTest, 1)";"(serve, 3)";"(Update, 4)";"(Watch, 2)";"(worker, 3)";"(Solve, 2)";}
"(newDirectIO, 2)" -> {"(newStdioPipes, 1)";}
"(roundTrip, 1)" -> {"(awaitOpenSlotForRequest, 1)";}
"(GetDockerLogs, 5)" -> {"(GetDockerLogs, 4)";}
"(fulfill, 3)" -> {}
"(Apply, 1)" -> {"(Remove, 1)";}
"(append, 1)" -> {}
"(newBasicProcess, 2)" -> {}
"(Create, 1)" -> {"(NewSnapshotter, 8)";"(StartTLS, 1)";"(Run, 2)";"(newMemberlist, 1)";"(newSerfQueries, 4)";}
"(getLatestSpotCostForInstance, 5)" -> {"(Add, 1)";}
"(newServerTransport, 4)" -> {}
"(newLeaseUpdater, 3)" -> {}
"(Pull, 3)" -> {"(pullV2Repository, 3)";}
"(Update, 2)" -> {"(Create, 2)";"(Update, 1)";"(reconcileTaskState, 4)";}
"(Add, 1)" -> {"(Open, 1)";"(Put, 1)";"(Push, 2)";"(Search, 2)";"(Insert, 2)";"(Load, 1)";}
"(build, 1)" -> {"(Open, 1)";"(openNewMongoGroupDriver, 5)";"(openNewMongoDriver, 4)";}
"(SetReference, 1)" -> {}
"(CreateProcess, 2)" -> {"(NewProcess, 2)";}
"(RunJasperProcess, 3)" -> {"(CreateProcess, 2)";}
"(apply, 2)" -> {"(Update, 2)";"(Remove, 1)";"(Apply, 2)";}
"(runFrame, 1)" -> {"(visitInstr, 2)";}
"(parseAndUploadResults, 4)" -> {"(sendTestLog, 4)";}
"(Apply, 2)" -> {"(Update, 1)";"(Run, 2)";}
"(Prune, 3)" -> {"(Process, 3)";}
"(handleLock, 2)" -> {"(Create, 2)";}
"(verify, 3)" -> {"(fulfill, 3)";}
"(Get, 2)" -> {"(New, 2)";"(Start, 1)";"(Do, 2)";"(implements, 1)";"(openNewMongoGroupDriver, 5)";"(Do, 3)";"(get, 1)";}
"(Remove, 1)" -> {"(Remove, 2)";"(Close, 1)";"(Search, 2)";"(Search, 1)";}
"(Create, 2)" -> {"(append, 1)";"(createIO, 5)";"(CopyConsole, 6)";"(CreateProcess, 2)";}
"(Sign, 1)" -> {"(New, 2)";"(Send, 0)";"(New, 3)";"(Decode, 1)";}
"(Load, 1)" -> {"(Create, 1)";}
"(WriteLogEntry, 1)" -> {"(Write, 1)";}
"(runCommandSet, 7)" -> {"(Execute, 4)";}
"(newTaskManager, 3)" -> {"(newTaskManager, 4)";}
"(Remove, 2)" -> {"(SetReference, 1)";}
"(serverHandshake, 1)" -> {"(newServerTransport, 4)";"(serverAuthenticate, 1)";}
"(StartJasperProcess, 3)" -> {"(CreateProcess, 2)";}
"(Get, 0)" -> {"(Do, 2)";"(remove, 1)";"(run, 4)";}
"(stop, 1)" -> {}
"(parseAddress, 1)" -> {"(Parse, 1)";}
"(New, 2)" -> {"(Update, 1)";"(Init, 2)";"(initializeSubsystem, 3)";"(load, 1)";}
"(New, 5)" -> {"(NewClient, 5)";}
"(runAgent, 4)" -> {}
"(ServeHTTP, 3)" -> {"(Execute, 2)";}
"(MakeLoggerWithContext, 3)" -> {}
"(Init, 2)" -> {"(SetReference, 1)";}
"(Add, 2)" -> {"(Push, 2)";"(Spec, 1)";"(Do, 2)";"(Remove, 1)";}
"(doRequest, 2)" -> {"(Do, 3)";}
"(fetchPack, 4)" -> {"(UploadPack, 2)";}
"(SetUpSuite, 1)" -> {"(WaitUntilStatus, 2)";"(SetUpTest, 1)";}
"(initializeSubsystem, 3)" -> {"(Create, 2)";}
"(NewClient, 3)" -> {"(Prepare, 1)";}
"(ForEachPackage, 2)" -> {"(allPackages, 3)";"(allPackages, 4)";}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(Decrypt, 1)" -> {"(Open, 4)";}
"(copyPipes, 7)" -> {}
"(serveBiDirectionalStream, 2)" -> {}
"(shutdownDaemon, 1)" -> {}
"(WatchFrom, 3)" -> {}
"(fetch, 2)" -> {"(fetchPack, 4)";}
"(List, 2)" -> {"(Walk, 3)";}
"(Update, 4)" -> {}
"(load, 1)" -> {"(parsePackageFiles, 2)";}
"(Watch, 2)" -> {"(WatchFrom, 3)";}
"(UpdateTaskStatus, 3)" -> {}
"(updateHealthMonitor, 1)" -> {"(monitor, 4)";}
"(allPackages, 3)" -> {}
"(pullSchema2, 4)" -> {"(pullSchema2Layers, 4)";}
"(initHandlers, 1)" -> {"(Remove, 1)";}
"(logStats, 2)" -> {}
"(newSession, 3)" -> {"(initHandlers, 1)";}
"(RoundTripOpt, 2)" -> {"(roundTrip, 1)";}
"(Decrypt, 2)" -> {"(Decrypt, 1)";"(Open, 4)";}
"(newSession, 5)" -> {}
"(Put, 1)" -> {"(Remove, 1)";"(Create, 1)";}
"(Release, 1)" -> {"(release, 1)";"(Update, 1)";"(Remove, 1)";}
"(Open, 1)" -> {"(start, 2)";}
"(sendTestLogs, 5)" -> {"(sendTestLog, 4)";}
"(Interpret, 5)" -> {"(call, 5)";}
"(Exec, 4)" -> {"(Exec, 2)";}
"(monitor, 4)" -> {}
"(Get, 3)" -> {"(Do, 2)";"(Do, 3)";}
"(useExistingTask, 3)" -> {"(DelayStart, 6)";}
"(Solve, 3)" -> {"(Exec, 6)";}
"(pushHashes, 5)" -> {}
"(start, 1)" -> {"(shutdownDaemon, 1)";"(handleControlSocketChange, 2)";"(createIO, 5)";"(CopyConsole, 6)";"(loadListeners, 2)";"(ContainerStart, 4)";"(Exec, 4)";"(NewDaemon, 3)";}
"(GetDockerLogs, 4)" -> {"(ContainerLogs, 3)";}
"(UploadPack, 2)" -> {}
"(parseFiles, 6)" -> {}
"(pullV2Tag, 3)" -> {"(pullSchema2, 4)";"(pullOCI, 4)";}
"(Prepare, 1)" -> {"(Upgrade, 7)";"(Pull, 8)";}
"(RoundTrip, 1)" -> {"(start, 1)";"(roundTrip, 1)";"(RoundTripOpt, 2)";}
"(startTask, 3)" -> {"(runTaskCommands, 2)";"(taskManager, 3)";"(logStats, 2)";"(runPreTaskCommands, 2)";}
"(Update, 1)" -> {"(ConcurrentUpdate, 4)";}
"(Process, 3)" -> {"(fixImports, 3)";"(fixImports, 2)";}
"(runCommands, 4)" -> {"(runCommandSet, 7)";}
"(worker, 3)" -> {"(useExistingTask, 3)";"(updateTask, 4)";}
"(Unmarshal, 2)" -> {"(Put, 1)";"(Decode, 1)";"(Set, 1)";}
"(NewSnapshotter, 8)" -> {}
"(fixImports, 2)" -> {}
"(Init, 1)" -> {"(startTask, 3)";"(Update, 1)";}
"(NewDaemon, 3)" -> {}
"(fixImports, 3)" -> {}
"(TryDialWithAddr, 2)" -> {"(NewClientConn, 3)";}
"(Walk, 3)" -> {"(Push, 1)";}
"(send, 3)" -> {}
"(TearDownSuite, 1)" -> {}
"(NewNetTransport, 1)" -> {}
"(Exec, 6)" -> {}
"(TryDial, 1)" -> {"(TryDialWithAddr, 2)";}
"(Set, 1)" -> {"(Search, 2)";}
"(pullOCI, 4)" -> {"(pullSchema2Layers, 4)";}
"(enableCSM, 3)" -> {"(Start, 2)";}
"(NewSigner, 4)" -> {"(New, 2)";}
"(Upgrade, 7)" -> {"(pull, 4)";}
"(NotifyConflict, 2)" -> {"(handleNodeConflict, 2)";}
"(Verify, 3)" -> {"(verify, 3)";}
"(Get, 1)" -> {"(Get, 2)";"(Load, 1)";"(Do, 2)";"(Get, 3)";"(Add, 2)";"(doRequest, 2)";"(Open, 1)";"(ServeHTTP, 2)";"(Remove, 1)";"(Get, 0)";"(get, 1)";"(Decode, 1)";}
"(CopyConsole, 6)" -> {}
"(NewProcess, 2)" -> {"(newBlockingProcess, 2)";"(newBasicProcess, 2)";}
"(awaitOpenSlotForRequest, 1)" -> {}
"(DelayStart, 6)" -> {}
"(applyTemplate, 3)" -> {"(Execute, 2)";}
"(pullSchema2Layers, 4)" -> {}
"(Run, 1)" -> {"(ViewAndWatch, 3)";"(WaitForCluster, 2)";"(StartJasperProcess, 3)";"(UpdateNode, 1)";"(Execute, 2)";"(wait, 1)";"(Run, 2)";"(RunJasperProcess, 3)";"(stop, 1)";"(GetDockerLogs, 5)";}
"(Push, 2)" -> {"(Remove, 2)";}
"(newTaskManager, 4)" -> {}
"(Pull, 8)" -> {"(pull, 4)";}
"(NewClient, 1)" -> {"(NewClient, 3)";}
"(newClientTransport, 6)" -> {}
"(Dial, 3)" -> {"(NewClientConn, 3)";}
"(verifySplunkConnection, 1)" -> {"(Copy, 2)";}
"(Insert, 2)" -> {"(insert, 4)";}
"(ConcurrentUpdate, 4)" -> {}
"(write, 3)" -> {"(Prune, 3)";}
"(containerStart, 4)" -> {"(initHealthMonitor, 1)";}
"(Walk, 2)" -> {"(List, 2)";}
"(NewLoggerWithContext, 4)" -> {"(MakeLoggerWithContext, 3)";}
"(Start, 2)" -> {"(Start, 1)";}
"(run, 1)" -> {"(Init, 1)";"(Add, 1)";"(Dial, 1)";"(superviseManager, 5)";"(newSession, 5)";"(Subscribe, 2)";"(UpdateRootCA, 1)";"(Start, 1)";"(Write, 1)";"(send, 3)";"(runAgent, 4)";"(Update, 2)";"(Do, 3)";"(run, 4)";"(Set, 1)";"(UpdateTaskStatus, 3)";}
"(Do, 3)" -> {"(Start, 1)";"(Prepare, 1)";}
"(run, 4)" -> {"(Import, 1)";"(Create, 2)";"(Interpret, 5)";}
"(Exec, 2)" -> {"(Solve, 3)";}
"(Load, 2)" -> {"(Get, 1)";"(Unmarshal, 2)";"(Release, 1)";"(load, 2)";"(newVertex, 5)";"(remoteID, 1)";"(Load, 1)";}
"(Import, 1)" -> {"(newLeaseUpdater, 3)";}
"(visitInstr, 2)" -> {}
"(Send, 0)" -> {"(Run, 1)";"(Remove, 1)";}
"(implements, 1)" -> {"(Build, 1)";}
"(ContainerStart, 4)" -> {"(containerStart, 4)";}
"(sendTestLogsAndResults, 6)" -> {"(sendTestLog, 4)";}
"(Encode, 1)" -> {"(Write, 1)";"(Copy, 2)";}
"(parsePackageFiles, 2)" -> {"(parseFiles, 6)";}
"(NewServerConn, 2)" -> {"(serverHandshake, 1)";}
"(worker, 4)" -> {}
"(handleControlSocketChange, 2)" -> {}
"(initHealthMonitor, 1)" -> {"(updateHealthMonitor, 1)";}
"(serverAuthenticate, 1)" -> {"(Verify, 2)";}
"(Init, 0)" -> {"(run, 3)";"(Add, 1)";"(Get, 0)";}
"(UpdateRootCA, 1)" -> {}
"(Copy, 2)" -> {"(copyPipes, 7)";"(Create, 1)";}
"(UpdateNode, 1)" -> {"(aliveNode, 3)";}
"(start, 2)" -> {}
"(CreateNode, 1)" -> {"(Send, 0)";}
"(ListenPipe, 2)" -> {}
"(insert, 4)" -> {}
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(run, 3)" -> {"(start, 2)";}
"(NewClient, 5)" -> {}
"(Do, 2)" -> {"(RoundTrip, 1)";}
"(pullV2Repository, 3)" -> {"(pullV2Tag, 3)";}
"(openNewMongoGroupDriver, 5)" -> {"(start, 2)";}
"(Solve, 2)" -> {"(Solve, 3)";}
"(Spec, 1)" -> {"(FromURL, 2)";}
"(executeOneFile, 5)" -> {"(sendTestLog, 4)";}
"(Join, 2)" -> {"(GetMember, 1)";}
"(ContainerLogs, 3)" -> {}
"(callSSA, 6)" -> {"(runFrame, 1)";}
"(newV2Client, 4)" -> {}
"(loadListeners, 2)" -> {"(Init, 4)";}
"(aliveNode, 3)" -> {"(NotifyConflict, 2)";}
"(Push, 1)" -> {"(PushContext, 2)";}
"(Execute, 2)" -> {"(Decrypt, 2)";}
"(Parse, 1)" -> {"(Open, 1)";"(Walk, 2)";"(Decode, 1)";}
"(createIO, 5)" -> {"(newDirectIO, 2)";}
"(runPreTaskCommands, 2)" -> {"(runCommands, 4)";}
"(New, 1)" -> {"(apply, 2)";"(Get, 1)";"(build, 1)";"(New, 5)";"(Get, 2)";"(Load, 2)";"(verifySplunkConnection, 1)";"(Join, 2)";"(New, 2)";"(Init, 0)";"(NewSigner, 4)";"(Log, 1)";"(Unmarshal, 2)";"(Ping, 1)";"(NewServer, 1)";"(Marshal, 1)";"(Get, 0)";"(Add, 1)";"(Parse, 1)";"(Read, 2)";"(NewClient, 2)";"(enableCSM, 3)";"(New, 3)";"(newSession, 3)";"(run, 1)";"(Open, 1)";"(CreateNode, 1)";"(newV2Client, 4)";"(Sign, 1)";"(parseAddress, 1)";}
"(Read, 2)" -> {"(Put, 1)";}
"(Search, 1)" -> {"(Execute, 2)";}
"(Init, 4)" -> {"(ListenPipe, 2)";}
"(WriteMessage, 1)" -> {"(Write, 1)";}
"(Search, 2)" -> {"(Execute, 2)";}
"(newServer, 2)" -> {"(NewServerConn, 2)";}
"(remove, 1)" -> {"(Remove, 2)";}
"(wait, 1)" -> {}
"(WaitUntilStatus, 2)" -> {}
"(runTaskCommands, 2)" -> {"(runCommands, 4)";}
"(updateTask, 4)" -> {"(DelayStart, 6)";}
"(handleNodeConflict, 2)" -> {}
"(cacheHostData, 4)" -> {"(New, 1)";"(getLatestSpotCostForInstance, 5)";}
"(runManager, 5)" -> {}
"(pull, 4)" -> {"(Pull, 3)";}
"(SetUpTest, 1)" -> {}
"(call, 5)" -> {"(callSSA, 6)";}
"(PushContext, 2)" -> {"(pushHashes, 5)";}
"(Build, 1)" -> {"(ForEachPackage, 2)";}
"(newBlockingProcess, 2)" -> {}
"(taskManager, 3)" -> {"(newTaskManager, 3)";}
"(sendTestLog, 4)" -> {"(sendTestLogToCedar, 4)";}
"(release, 1)" -> {"(Remove, 2)";}
"(newVertex, 5)" -> {"(load, 1)";}
"(Pull, 1)" -> {"(PullContext, 2)";}
"(Decode, 1)" -> {"(Close, 1)";}
"(New, 3)" -> {"(configureTLS, 4)";"(Release, 1)";"(newOracle, 4)";"(Pull, 1)";}
"(configureTLS, 4)" -> {}
"(ServeHTTP, 2)" -> {"(serveBiDirectionalStream, 2)";"(Do, 3)";"(handleLock, 2)";"(ServeHTTP, 3)";"(applyTemplate, 3)";}
"(Close, 1)" -> {"(List, 2)";}
"(NewServer, 1)" -> {"(newServer, 2)";}
"(newMemberlist, 1)" -> {"(NewNetTransport, 1)";}
"(PullContext, 2)" -> {"(fetch, 2)";}
"(load, 2)" -> {"(Insert, 2)";}
"(Marshal, 1)" -> {"(Get, 1)";"(Get, 0)";"(Put, 1)";"(Encode, 1)";}
"(newSerfQueries, 4)" -> {}
"(StartTLS, 1)" -> {}
"(reconcileTaskState, 4)" -> {}
"(get, 1)" -> {"(load, 1)";}
"(Dial, 1)" -> {"(TryDial, 1)";}
"(Start, 1)" -> {"(start, 1)";"(CopyConsole, 6)";"(worker, 4)";}
"(Ping, 1)" -> {"(doRequest, 2)";"(Get, 3)";}
"(FromURL, 2)" -> {"(Dial, 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: a30fb318ff554bfa7becbbbc3d5ad63e356be156

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.