Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Clean up profile and replay artifacts on pre-envelope drops

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java, kotlin

調査の方向性

The issue is in SentryClient's capture flow, specifically around envelope construction and sidecar file cleanup. Look at SentryClient, SentryEnvelopeItem.fromProfilingTrace, and SentryEnvelopeItem.fromReplay. The tests to add will involve temporary files and mocking EventProcessor and beforeSend callbacks. 'Done' means profile trace files and replay videos/folders are deleted on early drops, and discard reasons are correctly accounted for.

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

説明

Platform: Java Profiles

Problem

SentryClient currently relies on lazy envelope-item serialization to clean up file-backed transaction profiles and replay recordings. If capture terminates after those sidecars exist but before envelope construction, serialization never takes ownership and the files are not promptly deleted.

This affects both EventProcessor and beforeSend* drop paths. PR #6142 adds new fail-closed exits when an EventProcessor throws, but the same ownership gap already exists for intentional processor drops and beforeSend* drops.

Affected paths

Profiled transactions

A profiled transaction can return before buildEnvelope(..., profilingTraceData) when:

  • an EventProcessor returns null;
  • an EventProcessor throws and the SDK fails closed;
  • beforeSendTransaction returns null; or
  • beforeSendTransaction throws.

The profile trace is normally deleted by the lazy serializer created in SentryEnvelopeItem.fromProfilingTrace. These early returns prevent that cleanup, allowing sensitive profile data and disk usage to accumulate in long-running Android apps or JVM services.

Session replays

A replay can return before replay envelope construction when:

  • an EventProcessor returns null;
  • an EventProcessor throws and the SDK fails closed;
  • beforeSendReplay returns null; or
  • beforeSendReplay throws.

Replay cleanup currently occurs in the serializer created by SentryEnvelopeItem.fromReplay. Bypassing it can retain the replay video or, for a backfilled replay, the entire replay folder.

Expected behavior

Introduce explicit ownership for file-backed sidecars so every terminal pre-envelope drop either:

  1. transfers the sidecar to an envelope item that owns serialization and cleanup; or
  2. disposes of the sidecar immediately at the capture boundary.

The implementation should:

  • delete abandoned profile trace files;
  • delete normal replay videos and the correct backfilled replay folder;
  • record one dropped profile with the same discard reason as its transaction (event_processor, before_send, or callback_error);
  • avoid double deletion and double accounting; and
  • preserve existing replay-folder semantics and transaction/span discard quantities.

Tests

Add real temporary-file regression coverage for:

  • profiled transactions dropped by processor null and processor exception;
  • profiled transactions dropped by beforeSendTransaction null and exception;
  • normal replay videos dropped by processor and beforeSendReplay paths;
  • backfilled replay folders dropped by processor and beforeSendReplay paths; and
  • DataCategory.Profile accounting under each corresponding discard reason.

Context

This was identified while reviewing #6142. The fail-closed processor behavior is correct; the issue is that cleanup is coupled to envelope serialization even though several valid terminal paths return before an envelope is built.

主要言語
Kotlin
スター
1.4k
フォーク
478
平均マージ
2日 20時間
マージ済み PR(30日)
71

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

getsentry/sentry-java のほかの issue

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

似ている issue

Kotlin の issue をもっと見る

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

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