github-vet / github-vet/rangeloop-pointer-findings
jiten-thakkar/CS6963: src/lab3_paxos/paxos.go; 17 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#L380-L396)
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 389
[Click here to see the code in its original context.](https://github.com/jiten-thakkar/CS6963/blob/0e93608d1c84757da007dec801fdeb0bda6ae498/src/lab3_paxos/paxos.go#L380-L396)
Click here to show the 17 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 := &PrepareRequest{number, px.history.z_i, px.peers[px.me], proposedSequence}
reply := &PrepareReply{}
Ok := call(peerName, "Paxos.Prepare", request, reply)
if Ok {
prepareReplies <- *reply
px.peerInstances[peer] = reply.MaxFreeable
} else {
reply.Ok = false
prepareReplies <- *reply
}
}()
}
}
```
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
Start with src/lab3_paxos/paxos.go at lines 380-396 and inspect how the range-loop variable peer is used inside the goroutine, including the peerInstances update. Check the surrounding Paxos logic to determine whether this can affect behavior, then classify the finding as Bug, Mitigated, or Desirable Behavior as described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100