github-vet / github-vet/rangeloop-pointer-findings
percona/percona-backup-mongodb: cmd/pbm/status.go; 24 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [percona/percona-backup-mongodb](https://www.github.com/percona/percona-backup-mongodb) at [cmd/pbm/status.go](https://github.com/percona/percona-backup-mongodb/blob/d0affce704c7c9d1128abc9963a14ee9bbff284b/cmd/pbm/status.go#L89-L112)
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.
> reference to l is reassigned at line 111
[Click here to see the code in its original context.](https://github.com/percona/percona-backup-mongodb/blob/d0affce704c7c9d1128abc9963a14ee9bbff284b/cmd/pbm/status.go#L89-L112)
Click here to show the 24 line(s) of Go which triggered the analyzer.
```go
for _, l := range locks {
// We don't care about the PITR slicing here. It is a subject of other status sections
if l.Type == pbm.CmdPITR || l.Heartbeat.T+pbm.StaleFrameSec < ct.T {
continue
}
// Just check if all locks are for the same op
//
// It could happen that the healthy `lk` became stale by the time this check
// or the op was finished and the new one was started. So the `l.Type != lk.Type`
// would be true but for the legit reason (no error).
// But chances for that are quite low and on the next run of `pbm status` everythin
// would be ok. So no reason to complicate code to avoid that.
if lk != nil && l.OPID != lk.OPID {
if err != nil {
return nil, errors.Errorf("conflicting ops running: [%s/%s::%s-%s] [%s/%s::%s-%s]. This conflict may naturally resolve after 10 seconds",
l.Replset, l.Node, l.Type, l.OPID,
lk.Replset, lk.Node, lk.Type, lk.OPID,
)
}
}
lk = &l
}
```
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: d0affce704c7c9d1128abc9963a14ee9bbff284b
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.