go-ldap / ldap

Basic LDAP v3 functionality for the GO programming language.
Other
2.25k stars 355 forks source link

Panic of atomic.LoadInt64 on certain architectures #185

Open grzkv opened 6 years ago

grzkv commented 6 years ago

I get a panic on this line: https://github.com/go-ldap/ldap/blob/dc997b2033d4b4ab6de47b555eaf76888a81d33d/conn.go#L371

This happens only on linux/386 architecture.

I think this is the manifestation of this issue. It has a case for linux/386.

johnweldon commented 6 years ago

Can you provide a little more information about how you're reproducing this panic? A small test case, and the Go version you're using would be helpful.

grzkv commented 5 years ago

It is a memory alignment problem. Here's the open compiler issue https://github.com/golang/go/issues/599. To solve this you either have to declare that the lib does not support x86 architectures, or don't reference Int64 inside a struct via sync/atomic.

The problem is not replicated consistently, it happens only sometimes.

The Go version in use was 1.9.

Here are more of the same: https://github.com/golang/go/issues/6674 https://github.com/golang/groupcache/issues/66 Here's the code from one of the issues that may give replication of that issue https://play.golang.org/p/z4ZNdgqcdGA