Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure MessageServer.ReqID is 8 byte aligned (#2346)
Atomic operations such as atomic.AddUint64 must operate on 64-bit aligned memory when running on 32-bit systems, otherwise a runtime will panic occur. This is a known issue in go and might be addressed in a future release, see golang/go#36606. ## Motivation Using atomic.AddUint64 on non 64 bit aligned address on 32 bit systems results in a runtime panic. The solution is to guarantee the data it operates on is 64 bit aligned. This can be done by defining such fields as the first item in a struct. See #2336. Closes #2336 ## Changes Moving ReqID to the top of MessageServer guarantees 8 byte alignment. See https://go101.org/article/memory-layout.html section _The Alignment Requirement for 64-bit Word Atomic Operations_ for details on why this works. ## Test Plan This was tested on a Raspberry Pi 4B (armv7l) and on linux x86_64 resulting in no breaking changes. ## TODO - [ ] Test changes ## DevOps Notes - [x] This PR does not require configuration changes (e.g., environment variables, GitHub secrets, VM resources) - [x] This PR does not affect public APIs - [x] This PR does not rely on a new version of external services (PoET, elasticsearch, etc.) - [x] This PR does not make changes to log messages (which monitoring infrastructure may rely on) Co-authored-by: Nikita Kryuchkov <nkryuchkov10@gmail.com>
- Loading branch information