[Bug] Intermittent connection timeouts after upgrade from 3.7.2 -> 4.2.0
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 20/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
- 技術スタック
- cpp, networking
- 領域
- networking
調査の方向性
Start in ClientConnection.cc, where the connect path changed between v3.7.2 and v4.2.0, and follow the call to the ASIO connect_async free function down to the handleTcpConnected callback. The reporter's debug logs suggest the callback is never reached when the first endpoints refuse the connection. Done means understanding why the endpoint iteration stalls, reproducing it against multiple endpoints, and showing that connection attempts complete or fail over correctly.
索引モデルが issue の本文から書いたものです。
説明
Search before asking
- I searched in the issues and found nothing similar.
Version
Pulsar 4.2.0 on Rocky 9 Linux, connecting to Pulsar cluster running 4.0.11 in AWS
Minimal reproduce step
Unfortunately this is not easily reproducible in a test environment. We have a fairly widespread deployment of Pulsar, with many thousands of processes connecting from a variety of platforms 24/7. After upgrading the Pulsar client to v4.2.0 from v3.7.2, our telemetry indicated the sudden appearance of relatively rare intermittent connection timeouts: about 100 per day out of several hundred thousand. We've isolated the appearance of these timeouts to this code upgrade - we never saw this behavior on 3.7.2 or before (it's been used in production for >5 years).
I believe these timeouts have something to do with the code changes to ClientConnection.cc, which underwent some significant refactoring to adopt the new non-deprecated ASIO APIs: https://github.com/apache/pulsar-client-cpp/compare/v3.7.2..v4.2.0#diff-66de9f613070810cabd10f6103de05aaa9ca232d6de47ba388ec7178fdbe90ab
Our Pulsar cluster host names (we have three clusters, all are affected) resolve to AWS NLBs split across 3 availability zones, so the DNS resolution always results in 3 IP endpoints to connect to. We have both TLS and regular connections in the mix, and both are affected. The majority (but not all) of the timeout failures we see come from short-lived command line applications that fail on their very first connection attempt, so I don't think it's related to the connection state management code (like a socket being left in a weird state), but the initial connect path. It feels like an off-by-one that causes the connection state to get stuck after the first two attempts fail, but I haven't been able to find any direct evidence of this.
The previous code would individually attempt to connect to each endpoint directly with socket->connect_async, while the new code defers this logic to the ASIO::connect_async free function. We're using boost's ASIO from v1.85, the code for which ends up here. I find the code for this implementation to be rather absurd, but I've stepped through it in the debugger and on paper, and it seems like it should work... but somehow it's getting stuck.
One of our affected processes has Pulsar debug logging turned on, so we were able to get some more insight. From those logs we observe that when it times out on 4.2.0, the handleTcpConnected callback is never called until the timeout expires (currently set at 7 seconds) and forcefully closes the socket. Scrolling back in time to v3.7.2, I found a few cases where 1 or 2 of the IPs would fail with "connection refused", and then the next call would succeed, all within a matter of a few milliseconds.
I'm going to attempt a manual patch of the code to return it to explicitly iterating over the endpoint IPs (logging any intermediate failures) and see if that helps or provides additional clues, but I wanted to file an issue here to see if the project maintainers had any ideas on why this might suddenly start happening, and to see if anyone else was experiencing it. I'd appreciate any insight you might have. Thanks!
What did you expect to see?
No connection timeouts
What did you see instead?
~90-120 connection timeouts per day out of ~500k connection attempts, spread across three clusters
Anything else?
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!
- 主要言語
- C++
- スター
- 72
- フォーク
- 93
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/pulsar-client-cpp のほかの issue
-
難易度 3/5 半日 初心者へのやさしさ 62/100
apache/pulsar-client-cpp#623 ·
-
[Bug] MessageTest fails to build with GCC 15.3.0 and 16.2.1 (-Werror=stringop-truncation)対応中かも @davlgd が 3 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 25/100
apache/pulsar-client-cpp#621 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
apache/pulsar-client-cpp#620 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
apache/pulsar-client-cpp#619 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
apache/pulsar-client-cpp#617 ·
apache/pulsar-client-cpp の issue をすべて見る
似ている issue
-
Code: Performance
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
CrimsonCrossBunker/Cataclysm-Cleanwater-Bomb#1167 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
meshcore-dev/MeshCore#3760 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
deepseek-ai/DeepGEMM-Ascend#29 ·
メンテナーはふだん 1 日以内に返信
-
area:lattice bug
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信