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

evergreen-ci/evergreen: units/crons.go; 10 LoC

Open
#9,532 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
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/crons.go](https://github.com/evergreen-ci/evergreen/blob/a30fb318ff554bfa7becbbbc3d5ad63e356be156/units/crons.go#L253-L262)

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

[Click here to see the code in its original context.](https://github.com/evergreen-ci/evergreen/blob/a30fb318ff554bfa7becbbbc3d5ad63e356be156/units/crons.go#L253-L262)

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

```go
for _, h := range hosts {
if h.NoExpiration && h.UserHost && h.Status != evergreen.HostProvisionFailed && time.Now().After(h.ExpirationTime) {
grip.Error(message.Fields{
"message": "attempting to terminate an expired host marked as non-expiring",
"host": h.Id,
})
continue
}
catcher.Add(queue.Put(ctx, NewHostTerminationJob(env, &h, true, "host is expired, decommissioned, or failed to provision")))
}

```

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 {
"(resolve, 1)" -> {"(Clean, 1)";"(ResolveImageConfig, 4)";"(Join, 2)";}
"(roundTrip, 1)" -> {"(awaitOpenSlotForRequest, 1)";}
"(ListenPipe, 2)" -> {}
"(newV2Client, 4)" -> {}
"(Init, 4)" -> {"(ListenPipe, 2)";}
"(insert, 1)" -> {"(Insert, 2)";}
"(Write, 3)" -> {"(Decode, 1)";}
"(NewServer, 1)" -> {"(newServer, 2)";}
"(Subscribe, 2)" -> {}
"(Parse, 1)" -> {"(Decode, 1)";"(Open, 1)";"(Get, 1)";"(Info, 2)";"(Error, 2)";"(Walk, 2)";}
"(DeleteBucket, 1)" -> {"(Send, 0)";}
"(fetch, 2)" -> {"(fetchPack, 4)";}
"(UploadPack, 2)" -> {}
"(sendTestLogToCedar, 4)" -> {"(NewLoggerWithContext, 4)";}
"(New, 1)" -> {"(Get, 0)";"(CreateNode, 1)";"(Parse, 1)";"(Load, 2)";"(New, 2)";"(enableCSM, 3)";"(NewServer, 1)";"(NewSigner, 4)";"(Sign, 1)";"(New, 3)";"(Open, 1)";"(build, 1)";"(Init, 0)";"(New, 5)";"(Get, 2)";"(Add, 1)";"(apply, 2)";"(Marshal, 1)";"(newV2Client, 4)";"(run, 1)";"(Get, 1)";}
"(NewSnapshotter, 8)" -> {}
"(Apply, 2)" -> {"(Run, 2)";}
"(PullContext, 2)" -> {"(fetch, 2)";}
"(pushHashes, 5)" -> {}
"(parseAndUploadResults, 4)" -> {"(sendTestLog, 4)";}
"(Encode, 2)" -> {"(New, 2)";"(compress, 3)";}
"(addWriteConcern, 2)" -> {"(Delete, 1)";}
"(callSSA, 6)" -> {"(runFrame, 1)";}
"(runFrame, 1)" -> {"(visitInstr, 2)";}
"(Start, 2)" -> {"(Start, 1)";}
"(TearDownSuite, 1)" -> {}
"(Interpret, 5)" -> {"(call, 5)";}
"(sendTestLogsAndResults, 6)" -> {"(sendTestLog, 4)";}
"(sendTestLogs, 5)" -> {"(sendTestLog, 4)";}
"(runAgent, 4)" -> {}
"(PushContext, 2)" -> {"(pushHashes, 5)";}
"(Status, 2)" -> {"(append, 1)";}
"(newClientTransport, 6)" -> {}
"(Pull, 8)" -> {"(pull, 4)";}
"(shutdownDaemon, 1)" -> {}
"(ForEachPackage, 2)" -> {"(allPackages, 3)";"(allPackages, 4)";}
"(Info, 2)" -> {"(AddTraceEvent, 3)";}
"(aliveNode, 3)" -> {"(NotifyConflict, 2)";}
"(NotifyConflict, 2)" -> {"(handleNodeConflict, 2)";}
"(run, 3)" -> {"(start, 2)";}
"(Get, 0)" -> {"(Do, 2)";"(run, 4)";}
"(fulfill, 3)" -> {}
"(pullSchema2Layers, 4)" -> {}
"(Open, 4)" -> {"(Verify, 3)";}
"(pullSchema2, 4)" -> {"(pullSchema2Layers, 4)";}
"(Update, 3)" -> {"(validateSnapshot, 1)";"(Update, 2)";"(Do, 2)";"(validateContainer, 1)";"(validateInfo, 1)";"(validateImage, 1)";}
"(useExistingTask, 3)" -> {"(DelayStart, 6)";}
"(Clean, 1)" -> {"(Remove, 1)";}
"(Remove, 2)" -> {"(SetReference, 1)";}
"(Sub, 1)" -> {"(Add, 1)";}
"(newRequest, 2)" -> {"(Get, 1)";}
"(StartJasperProcess, 3)" -> {"(CreateProcess, 2)";}
"(Update, 2)" -> {"(reconcileTaskState, 4)";"(Create, 2)";}
"(openNewMongoGroupDriver, 5)" -> {"(start, 2)";}
"(encode, 1)" -> {"(init, 3)";}
"(DelayStart, 6)" -> {}
"(updateTask, 4)" -> {"(DelayStart, 6)";}
"(Execute, 4)" -> {"(executeOneFile, 5)";"(sendTestLogsAndResults, 6)";"(sendTestLogs, 5)";"(parseAndUploadResults, 4)";}
"(validateContainer, 1)" -> {"(Validate, 2)";}
"(UpdateRootCA, 1)" -> {}
"(Build, 1)" -> {"(ForEachPackage, 2)";}
"(pullV2Repository, 3)" -> {"(pullV2Tag, 3)";}
"(runCommandSet, 7)" -> {"(Execute, 4)";}
"(List, 2)" -> {"(Walk, 3)";}
"(start, 2)" -> {}
"(apply, 2)" -> {"(Update, 2)";"(Apply, 2)";}
"(Create, 4)" -> {"(Status, 2)";}
"(UpdateNode, 1)" -> {"(aliveNode, 3)";}
"(MakeLoggerWithContext, 3)" -> {}
"(NewHostTerminationJob, 4)" -> {"(Format, 1)";}
"(Start, 1)" -> {"(worker, 4)";"(start, 1)";"(CopyConsole, 6)";}
"(Query, 1)" -> {"(Send, 0)";}
"(initializeSubsystem, 3)" -> {"(Create, 2)";}
"(RoundTrip, 1)" -> {"(start, 1)";"(roundTrip, 1)";"(RoundTripOpt, 2)";}
"(parseFiles, 6)" -> {}
"(allPackages, 4)" -> {}
"(reconcileTaskState, 4)" -> {}
"(Search, 2)" -> {"(Do, 2)";"(Execute, 2)";}
"(GetDockerLogs, 4)" -> {"(ContainerLogs, 3)";}
"(TryDial, 1)" -> {"(TryDialWithAddr, 2)";}
"(Do, 2)" -> {"(RoundTrip, 1)";}
"(newTaskManager, 4)" -> {}
"(createIO, 5)" -> {"(newDirectIO, 2)";}
"(GetDockerLogs, 5)" -> {"(GetDockerLogs, 4)";}
"(updateHealthMonitor, 1)" -> {"(monitor, 4)";}
"(startTask, 3)" -> {"(runTaskCommands, 2)";"(taskManager, 3)";"(logStats, 2)";"(runPreTaskCommands, 2)";}
"(Update, 4)" -> {}
"(ContainerStart, 4)" -> {"(containerStart, 4)";}
"(Decrypt, 1)" -> {"(Open, 4)";}
"(Pull, 3)" -> {"(pullV2Repository, 3)";}
"(SetReference, 1)" -> {}
"(Load, 2)" -> {"(Get, 1)";"(load, 2)";}
"(newTaskManager, 3)" -> {"(newTaskManager, 4)";}
"(Decrypt, 2)" -> {"(Open, 4)";"(Decrypt, 1)";}
"(save, 1)" -> {"(Remove, 1)";"(Update, 3)";}
"(Prepare, 1)" -> {"(Upgrade, 7)";"(Pull, 8)";}
"(Clear, 1)" -> {"(Update, 1)";"(Remove, 1)";"(DeleteBucket, 1)";"(Delete, 1)";"(Add, 1)";"(doRequest, 4)";"(doRequest, 2)";}
"(Send, 0)" -> {"(Run, 1)";}
"(implements, 1)" -> {"(Build, 1)";}
"(CreateProcess, 2)" -> {"(NewProcess, 2)";}
"(Encode, 1)" -> {"(addSessionFields, 3)";"(addClusterTime, 4)";"(Write, 3)";"(Write, 1)";"(addReadConcern, 4)";"(Put, 1)";"(encode, 1)";"(String, 1)";"(addWriteConcern, 2)";"(New, 1)";"(Copy, 2)";}
"(Create, 1)" -> {"(StartTLS, 1)";"(Run, 2)";"(Do, 2)";"(CreateInstance, 2)";"(Dial, 1)";"(newMemberlist, 1)";"(newSerfQueries, 4)";"(NewSnapshotter, 8)";}
"(Walk, 2)" -> {"(List, 2)";}
"(PutObject, 1)" -> {"(Send, 0)";}
"(Process, 3)" -> {"(fixImports, 3)";"(fixImports, 2)";}
"(fixImports, 3)" -> {}
"(pull, 4)" -> {"(Pull, 3)";}
"(serverHandshake, 1)" -> {"(newServerTransport, 4)";}
"(Close, 2)" -> {"(Close, 1)";}
"(newMemberlist, 1)" -> {"(NewNetTransport, 1)";}
"(addReadConcern, 4)" -> {"(Delete, 1)";}
"(build, 1)" -> {"(Open, 1)";"(openNewMongoGroupDriver, 5)";"(openNewMongoDriver, 4)";}
"(load, 2)" -> {"(Insert, 2)";}
"(allPackages, 3)" -> {}
"(visitInstr, 2)" -> {}
"(Push, 2)" -> {"(Remove, 2)";}
"(worker, 4)" -> {}
"(StartTLS, 1)" -> {}
"(Import, 1)" -> {"(newLeaseUpdater, 3)";}
"(fixImports, 2)" -> {}
"(handleNodeConflict, 2)" -> {}
"(Dial, 1)" -> {"(TryDial, 1)";}
"(Open, 1)" -> {"(start, 2)";}
"(newSerfQueries, 4)" -> {}
"(Update, 1)" -> {"(ConcurrentUpdate, 4)";"(Update, 2)";}
"(stop, 1)" -> {}
"(taskManager, 3)" -> {"(newTaskManager, 3)";}
"(init, 1)" -> {"(New, 1)";"(Encode, 2)";"(Clear, 1)";"(init, 3)";"(startTLSIfRequired, 3)";}
"(Create, 2)" -> {"(append, 1)";"(createIO, 5)";"(CopyConsole, 6)";"(CreateProcess, 2)";}
"(Prune, 3)" -> {"(Process, 3)";}
"(handleLock, 2)" -> {"(Create, 2)";}
"(newStdioPipes, 1)" -> {"(ListenPipe, 2)";}
"(NewSigner, 4)" -> {"(New, 2)";}
"(get, 1)" -> {"(Get, 2)";"(New, 3)";"(Get, 1)";"(load, 1)";"(Get, 0)";}
"(validateSnapshot, 1)" -> {"(Validate, 2)";}
"(runManager, 5)" -> {}
"(newBlockingProcess, 2)" -> {}
"(init, 3)" -> {"(Init, 1)";"(insert, 1)";}
"(NewNetTransport, 1)" -> {}
"(Execute, 2)" -> {"(Decrypt, 2)";}
"(Verify, 3)" -> {"(verify, 3)";}
"(load, 1)" -> {"(parsePackageFiles, 2)";}
"(runPreTaskCommands, 2)" -> {"(runCommands, 4)";}
"(logStats, 2)" -> {}
"(startTLSIfRequired, 3)" -> {"(Client, 2)";}
"(Client, 2)" -> {"(NewClient, 3)";}
"(Init, 0)" -> {"(Add, 1)";"(Get, 0)";"(run, 3)";}
"(serve, 3)" -> {}
"(NewProcess, 2)" -> {"(newBasicProcess, 2)";"(newBlockingProcess, 2)";}
"(Close, 1)" -> {"(List, 2)";}
"(New, 5)" -> {"(NewClient, 5)";}
"(Insert, 2)" -> {"(insert, 4)";}
"(Spec, 1)" -> {"(FromURL, 2)";}
"(RunJasperProcess, 3)" -> {"(CreateProcess, 2)";}
"(Do, 3)" -> {"(Start, 1)";"(Prepare, 1)";}
"(Set, 1)" -> {"(Search, 2)";"(Parse, 1)";}
"(Run, 2)" -> {"(SetUpTest, 1)";"(Run, 1)";"(Watch, 2)";"(Prepare, 1)";"(Import, 1)";"(TearDownSuite, 1)";"(SetUpSuite, 1)";"(serve, 3)";"(Update, 4)";"(Create, 2)";"(worker, 3)";"(Solve, 2)";"(FromURL, 2)";}
"(call, 5)" -> {"(callSSA, 6)";}
"(compress, 3)" -> {"(Do, 2)";}
"(Marshal, 1)" -> {"(Get, 1)";"(Get, 0)";}
"(append, 1)" -> {}
"(RoundTripOpt, 2)" -> {"(roundTrip, 1)";}
"(TryDialWithAddr, 2)" -> {"(NewClientConn, 3)";}
"(run, 1)" -> {"(send, 3)";"(newSession, 5)";"(superviseManager, 5)";"(run, 4)";"(Subscribe, 2)";"(UpdateTaskStatus, 3)";"(Update, 2)";"(Do, 3)";"(Start, 1)";"(runAgent, 4)";"(Add, 1)";"(UpdateRootCA, 1)";"(Init, 1)";"(Dial, 1)";}
"(SetUpSuite, 1)" -> {"(WaitUntilStatus, 2)";"(SetUpTest, 1)";}
"(Run, 1)" -> {"(UpdateNode, 1)";"(stop, 1)";"(wait, 1)";"(GetDockerLogs, 5)";"(StartJasperProcess, 3)";"(RunJasperProcess, 3)";}
"(NewClientConn, 3)" -> {"(clientHandshake, 2)";}
"(serveBiDirectionalStream, 2)" -> {}
"(run, 4)" -> {"(Import, 1)";"(Create, 2)";"(Interpret, 5)";}
"(SetUpTest, 1)" -> {}
"(sendTestLog, 4)" -> {"(sendTestLogToCedar, 4)";}
"(verify, 3)" -> {"(fulfill, 3)";}
"(addClusterTime, 4)" -> {"(Delete, 1)";}
"(WatchFrom, 3)" -> {}
"(superviseManager, 5)" -> {"(runManager, 5)";}
"(Delete, 1)" -> {"(Do, 2)";"(Search, 2)";"(Update, 1)";}
"(NewDaemon, 3)" -> {}
"(Search, 1)" -> {"(Execute, 2)";}
"(configureTLS, 4)" -> {}
"(ConcurrentUpdate, 4)" -> {}
"(CreateNode, 1)" -> {"(Send, 0)";}
"(Upgrade, 7)" -> {"(pull, 4)";}
"(containerStart, 4)" -> {"(initHealthMonitor, 1)";}
"(New, 2)" -> {"(Update, 1)";"(Init, 2)";"(initializeSubsystem, 3)";"(load, 1)";}
"(Join, 2)" -> {"(GetMember, 1)";"(newRequest, 2)";}
"(Walk, 3)" -> {"(Push, 1)";}
"(newOracle, 4)" -> {"(Create, 2)";}
"(CreateInstance, 2)" -> {"(Create, 2)";}
"(newServerTransport, 4)" -> {}
"(runTaskCommands, 2)" -> {"(runCommands, 4)";}
"(monitor, 4)" -> {}
"(copyPipes, 7)" -> {}
"(handleControlSocketChange, 2)" -> {}
"(Put, 1)" -> {"(get, 1)";"(Set, 1)";"(Create, 1)";"(Remove, 1)";"(PutObject, 1)";}
"(doRequest, 2)" -> {"(Do, 3)";}
"(validateInfo, 1)" -> {"(Validate, 2)";}
"(openNewMongoDriver, 4)" -> {"(start, 2)";}
"(initHealthMonitor, 1)" -> {"(updateHealthMonitor, 1)";}
"(Exec, 6)" -> {}
"(newDirectIO, 2)" -> {"(newStdioPipes, 1)";}
"(pullV2Tag, 3)" -> {"(pullSchema2, 4)";"(pullOCI, 4)";}
"(resolveRemote, 4)" -> {"(Do, 3)";}
"(String, 1)" -> {"(Get, 1)";"(Deprecate, 3)";}
"(WaitUntilStatus, 2)" -> {}
"(pullOCI, 4)" -> {"(pullSchema2Layers, 4)";}
"(NewLoggerWithContext, 4)" -> {"(MakeLoggerWithContext, 3)";}
"(UpdateTaskStatus, 3)" -> {}
"(insert, 4)" -> {}
"(GetMember, 1)" -> {"(Send, 0)";}
"(start, 1)" -> {"(createIO, 5)";"(CopyConsole, 6)";"(loadListeners, 2)";"(ContainerStart, 4)";"(NewDaemon, 3)";"(shutdownDaemon, 1)";"(handleControlSocketChange, 2)";}
"(NewServerConn, 2)" -> {"(serverHandshake, 1)";}
"(runCommands, 4)" -> {"(runCommandSet, 7)";}
"(Init, 1)" -> {"(startTask, 3)";}
"(GetId, 1)" -> {"(Send, 0)";}
"(newServer, 2)" -> {"(NewServerConn, 2)";}
"(Add, 1)" -> {"(Insert, 2)";"(Open, 1)";"(Search, 2)";}
"(Deprecate, 3)" -> {"(Do, 2)";}
"(addSessionFields, 3)" -> {"(Delete, 1)";}
"(NewClient, 3)" -> {"(Prepare, 1)";}
"(Add, 2)" -> {"(New, 3)";"(Do, 2)";"(Remove, 1)";"(Push, 2)";"(get, 1)";"(Spec, 1)";"(New, 2)";}
"(enableCSM, 3)" -> {"(Start, 2)";}
"(fetchPack, 4)" -> {"(UploadPack, 2)";}
"(send, 3)" -> {}
"(newBasicProcess, 2)" -> {}
"(loadListeners, 2)" -> {"(Init, 4)";}
"(Pull, 1)" -> {"(PullContext, 2)";}
"(Set, 2)" -> {"(GetId, 1)";"(get, 1)";"(Set, 1)";"(New, 1)";"(Add, 2)";"(save, 1)";"(Parse, 1)";}
"(newSession, 5)" -> {}
"(write, 3)" -> {"(Prune, 3)";}
"(Dial, 3)" -> {"(NewClientConn, 3)";}
"(ServeHTTP, 2)" -> {"(serveBiDirectionalStream, 2)";"(handleLock, 2)";}
"(AddTraceEvent, 3)" -> {"(traceEvent, 2)";}
"(CopyConsole, 6)" -> {}
"(newLeaseUpdater, 3)" -> {}
"(Solve, 2)" -> {"(Solve, 3)";}
"(validateImage, 1)" -> {"(Validate, 2)";}
"(Decode, 1)" -> {"(Close, 1)";}
"(Format, 1)" -> {"(printColored, 5)";"(Encode, 1)";"(init, 1)";"(Set, 2)";"(resolve, 1)";}
"(Remove, 1)" -> {"(Close, 1)";"(Search, 2)";"(Search, 1)";"(Remove, 2)";"(Get, 1)";"(doRequest, 4)";}
"(Get, 2)" -> {"(Start, 1)";"(Do, 2)";"(implements, 1)";"(openNewMongoGroupDriver, 5)";"(Do, 3)";"(New, 2)";}
"(doRequest, 4)" -> {"(ServeHTTP, 2)";}
"(printColored, 5)" -> {"(Sub, 1)";}
"(Push, 1)" -> {"(PushContext, 2)";}
"(executeOneFile, 5)" -> {"(sendTestLog, 4)";}
"(Copy, 2)" -> {"(Open, 1)";"(Get, 0)";"(copyPipes, 7)";"(Create, 1)";"(Put, 1)";}
"(Sign, 1)" -> {"(New, 2)";"(Send, 0)";"(New, 3)";}
"(Watch, 2)" -> {"(WatchFrom, 3)";}
"(awaitOpenSlotForRequest, 1)" -> {}
"(ContainerLogs, 3)" -> {}
"(Init, 2)" -> {"(SetReference, 1)";}
"(parsePackageFiles, 2)" -> {"(parseFiles, 6)";}
"(FromURL, 2)" -> {"(Dial, 3)";}
"(Send, 1)" -> {"(Send, 0)";"(Create, 4)";}
"(wait, 1)" -> {}
"(traceEvent, 2)" -> {"(append, 1)";}
"(Solve, 3)" -> {"(Exec, 6)";}
"(clientHandshake, 2)" -> {"(newClientTransport, 6)";}
"(Validate, 2)" -> {"(Walk, 3)";}
"(New, 3)" -> {"(configureTLS, 4)";"(newOracle, 4)";"(Pull, 1)";}
"(Get, 1)" -> {"(ServeHTTP, 2)";"(Do, 2)";"(Get, 0)";"(Open, 1)";"(Get, 2)";}
"(Write, 1)" -> {"(Info, 2)";"(write, 3)";"(Parse, 1)";"(Close, 2)";"(Send, 1)";"(Get, 1)";"(Query, 1)";"(Add, 1)";"(Get, 0)";"(Update, 3)";"(Error, 2)";}
"(Error, 2)" -> {"(AddTraceEvent, 3)";}
"(worker, 3)" -> {"(useExistingTask, 3)";"(updateTask, 4)";}
"(NewClient, 5)" -> {}
"(ResolveImageConfig, 4)" -> {"(resolveRemote, 4)";}
}

```

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.