Skip to content

Conversation

@cce
Copy link
Contributor

@cce cce commented Oct 27, 2022

Summary

This fixes #4631 by aligning a 64-bit counter when used on 32-bit platforms.

Test Plan

Updated TestAtomicVariablesAlignment.

@cce cce added the Bug-Fix label Oct 27, 2022
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)
Copy link
Contributor

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?

Copy link
Contributor Author

@cce cce Oct 27, 2022

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.

algorandskiy
algorandskiy previously approved these changes Oct 27, 2022
@codecov
Copy link

codecov bot commented Oct 27, 2022

Codecov Report

Merging #4702 (b03b309) into master (ad08f74) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@            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     
Impacted Files Coverage Δ
network/wsPeer.go 68.44% <0.00%> (ø)
ledger/roundlru.go 90.56% <0.00%> (-5.67%) ⬇️
ledger/blockqueue.go 85.63% <0.00%> (-2.88%) ⬇️
crypto/merkletrie/trie.go 66.42% <0.00%> (-2.19%) ⬇️
agreement/cryptoVerifier.go 67.60% <0.00%> (-2.12%) ⬇️
agreement/proposalManager.go 96.07% <0.00%> (-1.97%) ⬇️
crypto/merkletrie/node.go 91.62% <0.00%> (-1.87%) ⬇️
data/transactions/verify/txn.go 76.19% <0.00%> (-0.96%) ⬇️
catchup/service.go 69.38% <0.00%> (ø)
... and 4 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@algorandskiy algorandskiy merged commit 40974ee into algorand:master Oct 28, 2022
@cce cce deleted the align-duplicateFilterCount branch March 1, 2023 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

panic: unaligned 64-bit atomic operation

4 participants