github-vet / github-vet/rangeloop-pointer-findings
jiten-thakkar/CS6963: src/lab3_paxos/paxos.go; 27 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [jiten-thakkar/CS6963](https://www.github.com/jiten-thakkar/CS6963) at [src/lab3_paxos/paxos.go](https://github.com/jiten-thakkar/CS6963/blob/0e93608d1c84757da007dec801fdeb0bda6ae498/src/lab3_paxos/paxos.go#L517-L543)
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 peer used in defer or goroutine at line 527
[Click here to see the code in its original context.](https://github.com/jiten-thakkar/CS6963/blob/0e93608d1c84757da007dec801fdeb0bda6ae498/src/lab3_paxos/paxos.go#L517-L543)
Click here to show the 27 line(s) of Go which triggered the analyzer.
```go
for _, peer := range px.peers {
if peer != px.peers[px.me] {
peerName := peer
go func() {
request := &DecideRequest{preparedSeq, v, number, px.history.z_i, px.peers[px.me]}
reply := &DecideReply{}
to := 5 * time.Millisecond
for !px.isdead() {
Ok := call(peerName, "Paxos.Decide", request, reply)
if Ok {
px.peerInstances[peer] = reply.MaxFreeable
px.mu.Lock()
if reply.HighestNumber > px.highestNumber {
px.highestNumber = reply.HighestNumber
}
px.mu.Unlock()
decideReplies <- *reply
if len(decideReplies) == (px.totalPeers/2) + 1 {
maxDone <- true
}
break
}
time.Sleep(to)
}
}()
}
}
```
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: 0e93608d1c84757da007dec801fdeb0bda6ae498
Contributor guide
No contributing guide indexed for this repository
Research direction
Read src/lab3_paxos/paxos.go at lines 517-543, starting with the goroutine and its captured range-loop variables. Trace the Paxos.Decide call, shared state updates, and retry loop to determine whether the analyzer finding affects behavior; done is a justified Bug, Mitigated, or Desirable Behavior classification.
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