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

ERROR: GetTransport of:xxx get timed_mutex timeout 解决办法 #456

Open
button-chen opened this issue Sep 13, 2023 · 0 comments
Open

ERROR: GetTransport of:xxx get timed_mutex timeout 解决办法 #456

button-chen opened this issue Sep 13, 2023 · 0 comments

Comments

@button-chen
Copy link

问题:
多线程并发调用 producer->send() 很容易得到错误消息:GetTransport of:xxx get timed_mutex timeout 除了libevent的版本问题,还有一个原因是gcc版本的bug

原因:
if (!lock.try_lock_for(std::chrono::seconds(m_tcpTransportTryLockTimeout))) {
LOG_ERROR("GetTransport of:%s get timed_mutex timeout", addr.c_str());
std::shared_ptr pTcp;
return pTcp;
}

gcc4.8.5的情况下,try_lock_for会立即返回,并不会等待期待的m_tcpTransportTryLockTimeout时长。 升级到4.9.0之后即可解决。

std::timed_mutex::try_lock_for bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54562

@ShannonDing 建议在首页说明使用gcc版本应该高于等于4.9.0

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

No branches or pull requests

1 participant