Skip to content

Conversation

@wangshao1
Copy link
Collaborator

@wangshao1 wangshao1 commented Jul 25, 2023

resend msgs when client_thread send failed and narrow down critical section

Fixes: #1815

NotifyWrite(ip_port);
}
} else if (ti.notify_type() == kNotiClose) {
LOG(INFO) << "received kNotiClose";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some improvements and bug risks to consider in the provided code patch:

Improvements:

  1. Remove the unnecessary blank line: The blank line at line 32 can be removed for cleaner code formatting.

Bug Risks:

  1. Accessing invalidated iterators: After swapping msgs with iter->second, the loop that follows assumes that msgs contains the originally stored messages. However, if there are other parts of the code that access to_send_[ip_port] concurrently and modify it after the swap, the loop may produce unexpected results or even result in undefined behavior due to accessing invalidated iterators. Consider using a different approach to process the messages to avoid this risk.

Overall, without full context and knowledge of the entire codebase, it's difficult to provide an exhaustive review. It's recommended to thoroughly test the modified code for any potential issues and ensure that all other parts of the codebase (not included in the provided snippet) work correctly with these modifications.

@chejinge chejinge merged commit f60c8df into OpenAtomFoundation:unstable Jul 27, 2023
bigdaronlee163 pushed a commit to bigdaronlee163/pika that referenced this pull request Jun 8, 2024
)

* fix: resend msgs when client_thread send failed and narrow down critical section

Co-authored-by: wangshaoyi <[email protected]>
cheniujh pushed a commit to cheniujh/pika that referenced this pull request Sep 24, 2024
)

* fix: resend msgs when client_thread send failed and narrow down critical section

Co-authored-by: wangshaoyi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

when send packet failed, packet maybe dropped

4 participants