-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
network: align duplicateFilterCount to prevent panic on 32-bit platforms #4702
Conversation
@@ -103,6 +103,7 @@ func TestAtomicVariablesAlignment(t *testing.T) { | |||
require.True(t, (unsafe.Offsetof(p.requestNonce)%8) == 0) | |||
require.True(t, (unsafe.Offsetof(p.lastPacketTime)%8) == 0) | |||
require.True(t, (unsafe.Offsetof(p.intermittentOutgoingMessageEnqueueTime)%8) == 0) | |||
require.True(t, (unsafe.Offsetof(p.duplicateFilterCount)%8) == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the test needs to loop through all the fields and make sure they are all fine, instead of checking just a handful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only fields that are used by atomic.LoadInt64, atomic.StoreInt64, atomic.AddInt64, etc.. have to be here, and these are the only 4 fields in the network package that are used with these functions.
Codecov Report
@@ Coverage Diff @@
## master #4702 +/- ##
==========================================
- Coverage 54.49% 54.48% -0.01%
==========================================
Files 407 407
Lines 52389 52389
==========================================
- Hits 28548 28544 -4
- Misses 21455 21457 +2
- Partials 2386 2388 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Summary
This fixes #4631 by aligning a 64-bit counter when used on 32-bit platforms.
Test Plan
Updated TestAtomicVariablesAlignment.