-
Notifications
You must be signed in to change notification settings - Fork 522
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
[mclagsyncd] fix out of order initialization #2112
[mclagsyncd] fix out of order initialization #2112
Conversation
@gechiang could you please review? |
86c14e5
to
36da3e8
Compare
@prsunny Could we merge this? |
Adding @Praveen-Brcm for visibility and the compilation enabling question. |
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.
LGTM. Let's wait for @Praveen-Brcm approval before I merge this in.
@Praveen-Brcm Have a look, please. |
@Praveen-Brcm it is undefined behavior, so the issue is not consistent, it is random. The issue could be easily see only when |
What I did
Reorder class member variables.
Why I did it
I've encountered an issue with m_bufSize, it's initialization is random, some times it may be initializied with 0, some times with random value.
m_bufSize
useMSG_BATCH_SIZE
for initialization:but
MSG_BATCH_SIZE
declared afterm_bufSize
so MSG_BATCH_SIZE will be initialized after m_bufSize, and m_bufSize will use MSG_BATCH_SIZE with uninitialized value.
How I verified it
Setup mclag topology, some times mclagsyncd will not be able to receive data after startup.
Details if related
More about this issue in cpp reference
IMHO it must be treated as compilation error, so it will be better to use
-Werror=reorder
parameter for compiler to avoid such issues.