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

ovh/cds: engine/api/workflow/dao_node_run_job.go; 11 LoC

Open
#7,359 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 [ovh/cds](https://www.github.com/ovh/cds) at [engine/api/workflow/dao_node_run_job.go](https://github.com/ovh/cds/blob/56af877c7efa9dabf3a12147d7ae8e1caa6d69db/engine/api/workflow/dao_node_run_job.go#L274-L284)

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 deadJob at line 276 may start a goroutine

[Click here to see the code in its original context.](https://github.com/ovh/cds/blob/56af877c7efa9dabf3a12147d7ae8e1caa6d69db/engine/api/workflow/dao_node_run_job.go#L274-L284)

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

```go
for i, deadJob := range deadJobsDB {
if store != nil {
getHatcheryInfo(ctx, store, &deadJob)
}

jr, err := deadJob.WorkflowNodeRunJob()
if err != nil {
return nil, err
}
deadJobs[i] = jr
}

```

Click here to show extra information the analyzer produced.

```
The following paths through the callgraph could lead to a goroutine:
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (process, 2) -> (Debugf, 3)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (Serve, 1) -> (int32, 1)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (Start, 2) -> (Start, 1) -> (start, 3)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (serve, 4) -> (Serve, 1) -> (int32, 1) -> (QueueJobSetVersion, 3) -> (StatusText, 1) -> (queueDirectArtifactUpload, 5) -> (FormDataContentType, 0) -> (ObjectTempUrl, 5) -> (ParseAndImport, 8)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (Serve, 1)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (Run, 3) -> (Update, 2) -> (UpdateColumns, 3)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (serve, 4) -> (Serve, 1) -> (int32, 1) -> (QueueJobSetVersion, 3)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (Do, 1)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (serve, 4) -> (Serve, 1) -> (int32, 1) -> (QueueJobSetVersion, 3) -> (StatusText, 1)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (Serve, 1) -> (int32, 1) -> (QueueJobSetVersion, 3) -> (StatusText, 1) -> (RecordCallWithMethodType, 9) -> (FormDataContentType, 0) -> (WriteFile, 4)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (serve, 4) -> (Serve, 1) -> (int32, 1) -> (QueueJobSetVersion, 3) -> (StatusText, 1) -> (queueDirectArtifactUpload, 5) -> (FormDataContentType, 0) -> (ObjectTempUrl, 5)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (Serve, 1) -> (int32, 1) -> (QueueJobSetVersion, 3) -> (StatusText, 1) -> (RecordCallWithMethodType, 9) -> (FormDataContentType, 0) -> (WriteFile, 4) -> (ContainerUpdate, 2)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (serve, 4)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (askForGettingStaticFiles, 2) -> (buildFromSource, 1) -> (execCommand, 1)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (Serve, 1) -> (int32, 1) -> (QueueJobSetVersion, 3) -> (StatusText, 1)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (serve, 4) -> (Serve, 1) -> (int32, 1) -> (QueueJobSetVersion, 3) -> (StatusText, 1) -> (queueDirectArtifactUpload, 5)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (Serve, 1) -> (int32, 1) -> (QueueJobSetVersion, 3) -> (StatusText, 1) -> (RecordCallWithMethodType, 9) -> (FormDataContentType, 0)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (checkStaticFiles, 1) -> (askForGettingStaticFiles, 2) -> (buildFromSource, 1) -> (execCommand, 1)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (Serve, 1) -> (int32, 1) -> (QueueJobSetVersion, 3)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (Serve, 1) -> (int32, 1) -> (QueueJobSetVersion, 3) -> (StatusText, 1) -> (RecordCallWithMethodType, 9)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (ConsumeKafka, 9)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (serve, 4) -> (Serve, 1)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (Run, 4) -> (Exec, 4)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (serve, 4) -> (Serve, 1) -> (int32, 1)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (serve, 4) -> (Serve, 1) -> (int32, 1) -> (QueueJobSetVersion, 3) -> (StatusText, 1) -> (queueDirectArtifactUpload, 5) -> (FormDataContentType, 0)
(getHatcheryInfo, 3) -> (Get, 2) -> (WithStack, 1) -> (callers, 0) -> (init, 0) -> (UTC, 0) -> (Interface, 0) -> (Valid, 1) -> (serve, 4) -> (Serve, 1) -> (int32, 1) -> (QueueJobSetVersion, 3) -> (StatusText, 1) -> (queueDirectArtifactUpload, 5) -> (FormDataContentType, 0) -> (ObjectTempUrl, 5) -> (ParseAndImport, 7)

```

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: 56af877c7efa9dabf3a12147d7ae8e1caa6d69db

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.