github-vet / github-vet/rangeloop-pointer-findings
AbnerZheng/ds: src/mapreduce/schedule.go; 13 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [AbnerZheng/ds](https://www.github.com/AbnerZheng/ds) at [src/mapreduce/schedule.go](https://github.com/AbnerZheng/ds/blob/f97f414ddaebc96af8c8eec96072f602938d0216/src/mapreduce/schedule.go#L37-L49)
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.
> range-loop variable worker used in defer or goroutine at line 41
[Click here to see the code in its original context.](https://github.com/AbnerZheng/ds/blob/f97f414ddaebc96af8c8eec96072f602938d0216/src/mapreduce/schedule.go#L37-L49)
Click here to show the 13 line(s) of Go which triggered the analyzer.
```go
for worker := range (mr.registerChannel) {
ok := call(worker, "Worker.DoTask", doTaskArgs, new(struct{}))
if ok {
go func() {
mr.registerChannel <- worker
}()
wg.Done()
return
} else {
go rpc_call(file, phase, taskNumber, other)
return
}
} // 拿到一个空闲的worker
```
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: f97f414ddaebc96af8c8eec96072f602938d0216
Contributor guide
No contributing guide indexed for this repository
Research direction
Open src/mapreduce/schedule.go around lines 37-49 and read the surrounding scheduling logic. Check the reported range-loop variable use with Go's goroutine capture behavior, then classify the finding as Bug, Mitigated, or Desirable Behavior by leaving the corresponding reaction on the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100