Skip to content

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

Closed

Description

@YevheniiKotyrlo

How do you use Sentry?

Sentry SaaS (sentry.io)

SDK version

0.49.5, and master at 12c8785

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.

Activity

  1. linear-code commented on Oct 28, 2026

    @linear-code
  2. added
    Rust
    Bug
    on Oct 28, 2026
  3. szokeasaurusrex commented on Oct 29, 2026

    @szokeasaurusrex
    Member

    @YevheniiKotyrlo good catch, thanks for the report. We will fix this

  4. added a commit that references this issue on Nov 20, 2026
    ab2de52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugRust

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions