-
Notifications
You must be signed in to change notification settings - Fork 204
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
Fix #707, Resolve highest MsgID of 0xFFFF bug #708
Fix #707, Resolve highest MsgID of 0xFFFF bug #708
Conversation
Ping @tngo67 |
@astrogeco requesting fast-track. |
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.
What about just making it "int", as it's only used as an index into an array and would be more compiler optimization friendly?
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.
Concur that the MsgKey should always be at least the size of MsgId, bigger is OK but smaller is not. However it should also be documented that at least one MsgId value must be considered "reserved" or invalid, and hence it is not possible to use every conceivable MsgId value in your routing table. It is possible that we have another bug lurking in the routing table if we allow a valid route to be configured for CFE_SB_INVALID_MSG_ID
Minimum size for int is 16 bits. Could go unsigned long? Happy to go either way, I just went fixed size since it was fixed size. Looking at the code in general fixed sizes are used even for iterators... I checked our standard and it doesn't care either way. |
I agree, in this case the fundamental issue is that MsgKey didn't have enough bits. The algorithm requires that the key has enough bits to hold at least I think in the original implementation, there was an assumption that if the lookup table grew beyond 2^16 entries, it would use some other more memory efficient algorithm like a hash table, rather than a direct lookup table. Even at 2^16 this is probably wasting a good chunk of memory. |
Changes Message Key from uint16 to uint32 to avoid rollover
49fab4b
to
71f3242
Compare
Added note about the table being + 1. |
@astrogeco please fast track this one |
Will merge right after CCB |
Describe the contribution
Changes Message Key from uint16 to uint32 to avoid rollover and system hang
Fix #707
Fix #414
Testing performed
Steps taken to test the contribution:
Expected behavior changes
Full message ID range available
System(s) tested on
Additional context
Identified/resolved by JSC
Third party code
None
Contributor Info - All information REQUIRED for consideration of pull request
Jacob Hageman - NASA/GSFC