-
Notifications
You must be signed in to change notification settings - Fork 690
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 for cm_svc_run #1484
Fix for cm_svc_run #1484
Conversation
cm_svc_process_sock(svc); | ||
/* svc->contexts will be changed, so need to assign again */ | ||
fds = svc->contexts; |
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.
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.
nit: I would say 'svc->contexts may have been reallocated' rather than 'will be changed' Fix looks good.
eeff9f8
to
c5abe17
Compare
@rleon I'm glad you responded and pointed out my problem. I've updated the commit msg. Hope it works this time. |
When the cm_svc_run thread starts, svc->contexts will be initialized with four elements. When reallocating memory due to an increased element count, svc->contexts will point to new addresses, whereas the fds variable in the cm_svc_run thread is free of the address, which will result in subsequent cm_svc_run threads running incorrectly. So we need to update the fds variable every time the cm_svc_process_sock function is processed. Fixes: b60c79d ("rsockets: Use service thread to accept connections") Signed-off-by: linxiaochou <929331108@qq.com>
c5abe17
to
24061f0
Compare
@shefty Thank you for your reply and suggestions. I have already revised the corresponding notes. Hope it can work this time. |
When the cm_svc_run thread starts, the four element size rss will be allocated to svc->contexts. When the rss reallocates memory due to an increase in the number of elements in the cm_svc_process_sock function, the rss will point to a new address, but the cm_svc_run function does not get the new address again, leading to an exception in the future