-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
testing: atomic variable offsets static analysis tool #5027
Comments
This is necessary for us to drop the unsupported flag: #4749 |
@philips I agree with you. To drop the flag, we need to be confident with arm. We need to have this tool and make sure other dependencies work well with arm/32bit (for example boltdb). We need to have doc around how to build and what are the limitations. @luxas It would be great if you can help with arm part. Thanks! |
Here's my initial plan.
Example generated program. package main
// imports
func main() {
var f foo
if invalidOffset(unsafe.Offsetof(f.bar)) {
fmt.Fprintln(os.Stderr, "invalid offset of field foo.bar")
os.Exit(2)
}
} |
@ericchiang Sounds good. We should make sure though that we make it generic, so k8s for example may use it. There haven't been known issues with atomic alignment in k8s, but it's a huge project, so probably somewhere something is wrong. @xiang90 @philips I may send a PR that compiles Also, when will a |
@ericchiang and I chatted yesterday about doing static anlaysis for this. Detecting alignment problems is a lot more difficult than his initial proposal. Some examples: Interfaces: func (i *consistentIndex) ConsistentIndex() uint64 {
return atomic.LoadUint64((*uint64)(i))
} slices: type A struct {
x int64
y int32
}
s := make([]A, 2)
a := &s[1]
atomic.LoadInt64(&a.x) |
@heyitsanthony I think we should just close this. People start to run tests + CI to ensure etcd is good on a platform. Here is the doc for that: https://github.com/coreos/etcd/blob/master/Documentation/op-guide/supported-platform.md Static analysis could be beneficial, but it does seem that no one will work on that just for etcd. |
Every few months etcd breaks on 32 bit systems due to atomic alignments, see #4734 and #4733. We need a static analysis tool to check for unaligned atomics that is part of our test runs.
cc @luxas
The text was updated successfully, but these errors were encountered: