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

RedisConnection释放的bug #1600

Open
higithubhi opened this issue May 11, 2023 · 2 comments
Open

RedisConnection释放的bug #1600

higithubhi opened this issue May 11, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@higithubhi
Copy link

最近测试drogon的时候,经常发现系统崩溃,经过研究,bug应该是很明确了,就是在RedisConnection的析构函数~RedisConnection调用了redisAsyncDisconnect,redisAsyncDisconnect最终调用了 shared_from_this,但是这个时候shared_from_this会直接抛出异常,因为其进入析构函数后,其父对象(_Wptr)已经为空,下面是崩溃的线程调用栈:
core.log

@hwc0919 hwc0919 added the bug Something isn't working label May 11, 2023
@hwc0919
Copy link
Member

hwc0919 commented May 11, 2023

RedisConnection.cc:232

redisAsyncSetDisconnectCallback(
redisContext_, [](const redisAsyncContext *context, int /*status*/) {
auto thisPtr = static_cast<RedisConnection *>(context->ev.data);
thisPtr->handleDisconnect();
if (thisPtr->disconnectCallback_)
{
thisPtr->disconnectCallback_(thisPtr->shared_from_this());
}
LOG_TRACE << "Disconnected from "
<< thisPtr->serverAddr_.toIpPort();
});
}

@hwc0919
Copy link
Member

hwc0919 commented May 23, 2023

能否帮忙测试下这个PR #1618,看看是否解决问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants