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 Acceptor::BeforeRecycle during Accept::StartAccept dead lock #1791

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wwbmmm
Copy link
Contributor

@wwbmmm wwbmmm commented Jun 10, 2022

Fix #1772

@@ -875,6 +870,12 @@ int Socket::SetFailed() {
return SetFailed(EFAILEDSOCKET, NULL);
}

int Socket::SetFailedOnCreate(int error_code, const char* error_text) {
_user = NULL; // Avoid calling _user->BeforeRecycle() which may cause dead lock or double free
Copy link
Contributor

Choose a reason for hiding this comment

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

这个是不是可以反过来在BeforeRecycle前判一下rpc failed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里主要是为了区分是在Create Socket过程中出错,还是使用Socket过程中出错
回调BeforeRecycle的时候,Socket已经是Failed的状态了,似乎难以区分是不是Create Socket的过程

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.

brpc::Acceptor::StartAccept和brpc::Acceptor::BeforeRecycle之间构成死锁
2 participants