`Transport::flush` on an `Arc<T>` transport returns `true` without flushing `T`

オープン 初心者向け
#1,374 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

@sentry-junior がすでに取り組んでいます。

2026年10月29日 から。

  • #1390 @sentry-junior による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
backend

調査の方向性

sentry-core/src/transport/mod.rsを読み、特にArc<T>に対するTransportの実装と、traitのデフォルトのflushを確認してください。NeverDrains::flushがfalseを返すissue内の再現例で、動作を確認してください。Arc<T>経由でflushしたときに、ラップされたtransportの結果が返れば完了です。近くにtransportのテストがあれば、それも確認してください。

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

説明

Bug Rust
How do you use Sentry?

Sentry SaaS (sentry.io)

SDK version

0.49.5, and master at 12c8785008a9046ddb73a238349c95447e78dde4

Steps to reproduce

impl<T: Transport> Transport for Arc<T> forwards send_envelope and shutdown to T but not flush, so flush called through an Arc<T> runs the trait's default, which returns true at once.

  1. A binary with this Cargo.toml:

    [package]
    name = "arc-transport-flush"
    version = "0.1.0"
    edition = "2024"
    publish = false
    
    [dependencies]
    sentry-core = { git = "https://github.com/getsentry/sentry-rust", rev = "12c8785008a9046ddb73a238349c95447e78dde4" }
    
    [workspace]
    

    and this src/main.rs, whose transport's flush always reports envelopes left behind:

    use std::sync::Arc;
    use std::time::Duration;
    
    use sentry_core::{Envelope, Transport};
    
    /// A transport whose queue never drains, so every flush reports envelopes left behind.
    struct NeverDrains;
    
    impl Transport for NeverDrains {
        fn send_envelope(&self, envelope: Envelope) {
            let _ = envelope;
        }
    
        fn flush(&self, _timeout: Duration) -> bool {
            false
        }
    }
    
    fn main() {
        let direct = Transport::flush(&NeverDrains, Duration::ZERO);
        let through_arc = Transport::flush(&Arc::new(NeverDrains), Duration::ZERO);
        let shutdown_through_arc = Transport::shutdown(&Arc::new(NeverDrains), Duration::ZERO);
        println!("flush on the transport: {direct}");
        println!("flush on Arc<transport>: {through_arc}");
        println!("shutdown on Arc<transport>: {shutdown_through_arc}");
    }
    
  2. cargo run

Expected result

flush on Arc<transport>: false, what flush on the transport itself returns.

Actual result
flush on the transport: false
flush on Arc<transport>: true
shutdown on Arc<transport>: false

rustc 1.99.1 on Windows 11 x64. A caller told by flush through the Arc that the queue drained can end the process with envelopes still queued in T.

主要言語
Rust
スター
755
フォーク
192
平均マージ
3日 15時間
マージ済み PR(30日)
12

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

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

getsentry/sentry-rust のほかの issue

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

似ている issue

Rust の issue をもっと見る

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

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