github-vet / github-vet/rangeloop-pointer-findings
skyitachi/MIT6.824: src/shardkv/server.go; 32 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [skyitachi/MIT6.824](https://www.github.com/skyitachi/MIT6.824) at [src/shardkv/server.go](https://github.com/skyitachi/MIT6.824/blob/1285462675d61cc93fc6b7dd9decb1823f34c146/src/shardkv/server.go#L873-L904)
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 num used in defer or goroutine at line 893
[Click here to see the code in its original context.](https://github.com/skyitachi/MIT6.824/blob/1285462675d61cc93fc6b7dd9decb1823f34c146/src/shardkv/server.go#L873-L904)
Click here to show the 32 line(s) of Go which triggered the analyzer.
```go
for _, num := range grp {
v := kv.needdel[num]
for g, s := range v {
sl := make([]int, 0)
for i := 0; i < len(s); i++ {
sl = append(sl, s[i])
}
args := &DelArgs{sl, int64(kv.gid), num}
servers := kv.delconfig[num][g]
go func(ggid int, serv []string, arg *DelArgs) {
for {
for _, si := range serv {
reply := &DelReply{}
srv := kv.make_end(si)
DPrintf("group %d-%d will delete data %v in group %d", kv.gid, kv.me, arg.Shard, ggid)
ok := srv.Call("ShardKV.Del", arg, reply)
if ok && reply.WrongLeader == false {
kv.mu.Lock()
DPrintf("1. group %d-%d delete data successful in %d", kv.gid, kv.me, ggid)
delete(kv.needdel[num], ggid)
DPrintf("2. group %d-%d delete data successful in %d", kv.gid, kv.me, ggid)
kv.mu.Unlock()
return
}
time.Sleep(20 * time.Millisecond)
}
}
}(g, servers, args)
}
}
```
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: 1285462675d61cc93fc6b7dd9decb1823f34c146
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.