Add opt-in strict callback mode

オープン
#6,662 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
android, java, kotlin, spring-boot
領域
backend, devtools

調査の方向性

Read the callback error isolation spec and review the closed draft in #6173, especially its open review points and the callback error paths it describes. Map the SDK option and external configuration entry points, then trace how callback failures reach capture and integration code. Done means strict mode propagates callback failures as specified while excluding the failed callback from reporting, with normal mode preserving isolation; the issue does not identify specific source files or tests.

索引モデルが issue の本文から書いたものです。

説明

Improvement Java Platform: Java

The SDK isolates failures in user callbacks (beforeSend*, beforeBreadcrumb, samplers, event processors, etc.): the error is logged, the data is dropped, and a callback_error client report is recorded (#6081, released in 8.61.0). There is currently no way to make those failures surface, which makes buggy callbacks hard to notice and debug during development.

The callback error isolation spec (getsentry/sentry-docs#19189) allows an opt-in strict mode:

  • MAY offer it, disabled by default.
  • In strict mode, a callback failure MUST propagate as an unhandled error of the host application instead of being isolated.
  • The event reporting that error MUST NOT go through the callback that failed.
  • Any callback failure while processing that event, or data created while reporting it (e.g. breadcrumbs), MUST be isolated instead of propagated.

Outside strict mode, the SDK MUST NOT re-throw or capture callback errors as events.

Prior attempt

A draft implementation was closed unmerged as not ready: #6173 (branch feat/strict-callback-mode, built on the callback-errors stack starting at #6140). It added a strictCallbackMode option (default off) with:

  • Callback failures wrapped in marker exceptions/errors with the original failure as cause, propagated via ExceptionUtils.maybeRethrow() before logging or discard accounting, including enclosing SDK catches and async completion paths.
  • Events containing a callback marker (incl. nested/cyclic causes and ExceptionMechanismException) silently excluded before capture callbacks, processors, logging, or discard accounting; same exclusion in the JUL, Logback, Log4j2, and Timber integrations.
  • Async failures following the host API's behavior (returned futures keep the failure; the SDK does not terminate the process).
  • Config via SDK options, strict-callback-mode external config, io.sentry.strict-callback-mode Android manifest metadata, and sentry.strict-callback-mode Spring Boot property.

Open points from review on #6173:

  • Design of CallbackUtils.
  • Some code paths started throwing where they previously swallowed exceptions independent of the flag, which would be a breaking change for a minor.
  • Marker logging during uncaught-exception capture, feedback dismiss-listener cleanup, and proxy-only Log4j2 events.

Related: #5513 (stop catching non-recoverable Throwables in the next major) is a separate, broader change.

Shipping behind the flag in a minor and possibly flipping the default in a major was floated as an option.

via alexander.dinauer.

--

View Session [Sentry]

主要言語
Kotlin
スター
1.4k
フォーク
483
平均マージ
2日 54分
マージ済み PR(30日)
207

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

getsentry/sentry-java のほかの issue

getsentry/sentry-java の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。