DataDog / datadog-go

go dogstatsd client library for datadog
MIT License
353 stars 132 forks source link

Ensure that the atomic uint64 will always be aligned #260

Closed jdgordon closed 1 year ago

jdgordon commented 2 years ago

I'm not sure if this is a bug in the go compiler, or if this struct is being embedded somewhere which is breaking alignment rules, but on ARM atomic access to the nbContext field causes a panic due to unaligned access. Switching to a pointer ensures it will always be correctly aligned.

I have been running this branch on my device for the last 2 weeks without any other issues.

sgnn7 commented 2 years ago

Hey @jdgordon, We're aware of this issue and have started fixing it in some spots but we haven't gotten to this code yet. Let me see if I can find the right person to take a look at this and decide if we want to move to go.uber.com/atomic for this code as well.

djmitche commented 2 years ago

Thanks! We're standardizing on go.uber.org/atomic for the datadog-agent itself, so it would make sense to do the same here. It should be an easy change to this PR.

DylanRJohnston-FZ commented 2 years ago

We've hit this issue in production and will have to use this fork for now.

katiehockman commented 2 years ago

Thanks for your patience with this. @knusbaum has a PR out now that should fix the issue for you. There are just a few more changes that need to happen on that PR before it can be merged.

knusbaum commented 1 year ago

The fix for this issue was merged and released in 1.42.0. I'm going to close this now, but thank you for the contribution.