Skip to content
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 batch create stream and make SetHostSocket thread safe #2938

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jenrryyou
Copy link
Contributor

@jenrryyou jenrryyou commented Apr 5, 2025

What problem does this PR solve?

修复#2754合入后发现的问题:

  1. 有一处存在use after free;

  2. SetHostSocket可能会并发调用,增加并发安全性;

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects(性能影响):

  • Breaking backward compatibility(向后兼容性):
    完全兼容


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@jenrryyou jenrryyou force-pushed the fix_batch_create_stream branch 4 times, most recently from 5b8021a to 41f3c2c Compare April 6, 2025 04:03
@@ -134,6 +134,7 @@ friend struct butil::DefaultDeleter<Stream>;
butil::IOBuf *_pending_buf;
int64_t _start_idle_timer_us;
bthread_timer_t _idle_timer;
std::once_flag set_host_socket_flag;
Copy link
Contributor

Choose a reason for hiding this comment

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

私有成员用 _ 开头

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@jenrryyou jenrryyou force-pushed the fix_batch_create_stream branch from 41f3c2c to 882977b Compare April 6, 2025 12:06
@wwbmmm
Copy link
Contributor

wwbmmm commented Apr 7, 2025

LGTM

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.

2 participants