Make zombie loggers logic more robust
メンテナーはふだん 5 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- cpp, ios
調査の方向性
lib/api/Logger.cpp の 948 行付近にある Logger::RecordShutdown から始め、FlushAndTeardown 中に使用されるゾンビ logger 保護を追跡してください。LogManager Initialize/FlushTeardown と GetLogger のパスを確認し、その後、100,000 回の反復にわたる並行ロギングを行う提案されたストレステストを検討してください。完了の条件は、クラッシュを導入することなく、この競合によってデッドロックや終了時のハングが発生しなくなることです。
索引モデルが issue の本文から書いたものです。
説明
Describe your environment.
This issue is reproducible in one popular app on older models of iOS devices with slower processor.
Steps to reproduce.
Steps:
- application exiting.
- main thread is calling
FlushAndTeardown. - at about the same time another thread is scheduled to perform logging on
ILogger. - both clash with a deadlock in zombie logger protection code in
Logger::RecordShutdown()method.
What is the expected behavior?
Well, it is expected that applications do not abuse the logging API that way.. At the same time we have some protection mechanism in place, to allow the safe use-after-free. Just that protection mechanism is failing at extremely low rate, unique to the concurrent-use-during-free.
What did you expect to see?
I expect:
- the app should avoid doing what it is doing.
- the zombie logger logic MAY be improved to handle this race condition / deadlock in zombie-logger protection code in a better way.
What is the actual behavior?
Deadlock and hang on app termination, hang in the fool-proof code that is supposed to prevent a crash due to use-after-free. As of note, the code very reliably preventing the crash ... by hanging instead. Unfortunately that hang is eventually reported as a crash.
Additional context.
The crash rate right now is extremely low. It does not seem to affect newer devices.
I think we need to add the following stress test:
Initialize/FlushTeardownin a tight loop onLogManagerinstance.- rogue thread(s) attempting to obtain loggers via
GetLoggerand log massive volumes of data
Basic expectation here that the app should not crash after a 100,000 iterations like this. I am not sure if we can use some other fuzzy testing tools to artificially cause the deadlock.
Solution could be to perform timed-wait on mutex here:
https://github.com/microsoft/cpp_client_telemetry/blob/a924650883ecfd44f12dba131ca117f502f372b9/lib/api/Logger.cpp#L948
And when we see that the timeout happened, we return status back, and we avoid doing anything on that ILogger instance - discarding events that are timing out on that path.
- 主要言語
- C
- スター
- 102
- フォーク
- 67
- 平均マージ
- 5日 5時間
- マージ済み PR(30日)
- 8
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/cpp_client_telemetry のほかの issue
-
C API enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
microsoft/cpp_client_telemetry#628 ·
メンテナーはふだん 5 日以内に返信
-
OneDS C++ SDK retries already-ingested iOS events, causing duplicate telemetry records対応中かも @bmehta001 が 6 日前に担当しました。 オープンbug
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
microsoft/cpp_client_telemetry#1542 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 5 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
microsoft/cpp_client_telemetry#1504 ·
メンテナーはふだん 5 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
microsoft/cpp_client_telemetry#1413 · コメント 2 件 ·
メンテナーはふだん 5 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
microsoft/cpp_client_telemetry#1387 ·
メンテナーはふだん 5 日以内に返信
microsoft/cpp_client_telemetry の issue をすべて見る
似ている issue
-
Feature Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信
-
docs
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openwrt/firmware-utils#82 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
FujiNetWIFI/fujinet-firmware#1849 ·
メンテナーはふだん 1 日以内に返信
-
area:http-gateway good first issue priority:low type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
crazy-goat/php-fpm-ng#870 ·
メンテナーはふだん 1 日以内に返信