apache / apache/rocketmq-client-cpp

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

Offen
#456 0 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C++
Sterne
393
Forks
167
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

问题:
多线程并发调用 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by locating the project's homepage or installation requirements documentation mentioned in the issue. Document that GCC 4.9.0 or newer is required, including the reported std::timed_mutex::try_lock_for limitation; the work is done when the requirement is visible to users.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.