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

jiten-thakkar/CS6963: src/lab3_paxos/paxos.go; 17 LoC

Open
#16,578 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 [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#L460-L476)

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 469

[Click here to see the code in its original context.](https://github.com/jiten-thakkar/CS6963/blob/0e93608d1c84757da007dec801fdeb0bda6ae498/src/lab3_paxos/paxos.go#L460-L476)

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 := &AcceptRequest{number, v, px.history.z_i, px.peers[px.me], proposedSequence}
reply := &AcceptReply{}
Ok := call(peerName, "Paxos.Accept", request, reply)
if Ok {
acceptReplies <- *reply
px.peerInstances[peer] = reply.MaxFreeable
} else {
reply.Ok = false
acceptReplies <- *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

Read src/lab3_paxos/paxos.go at lines 460-476 and inspect the reported range-loop variable use in the goroutine. Compare the snippet with the analyzer guidance, then classify the finding as Bug, Mitigated, or Desirable Behavior using the requested reaction; done means one classification reaction is left.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.