jonhoo / rust-imap

IMAP client library for Rust
Apache License 2.0
484 stars 84 forks source link

Panic in imap #295

Open HermesOrl opened 1 month ago

HermesOrl commented 1 month ago

A panic occurs when multithreading inside the library:

warning: `imap_client` (bin “imap_client”) generated 7 warnings (run `cargo fix --bin “imap_client”` to apply 5 suggestions)
    The `dev` [unoptimized + debuginfo] profile target(s) completed in 0.09s
warning: the following packages contain code that will be rejected by a future version of Rust: imap-proto v0.10.2
Note: to find out what the problems were, use the `--future-incompat-report` option, or run the `cargo report future-incompatibilities --id 1` command.
     Running the `target\debug\imap_client.exe`
thread '<unnamed>' panicked in C:\Users\Nikolay\.cargo\registry\src\index.crates.io-6f17d22bba15001f\imap-2.4.1\src\parse.rs:210:21:
internal error: unreachable code entered
reverse stack trace:
   0: std::panicking::begin_panic_handler
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\panicking.rs:652
   1: core::panicking::panic_fmt
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\core\src\panicking.rs:72
   2: core::panicking::panic
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\core\src\panicking.rs:146
   3: imap::parse::parse_mailbox
             at C:\Users\Nikolay\.cargo\registry\src\index.crates.io-6f17d22bba15001f\imap-2.4.1\src\parse.rs:210
   4: imap::client::impl$7::select::closure$0<native_tls::TlsStream<std::net::tcp::TcpStream>,ref$<str$> >
             at C:\Users\Nikolay\.cargo\registry\src\index.crates.io-6f17d22bba15001f\imap-2.4.1\src\client.rs:527
   5: enum2$<core::result::Result<alloc::vec::Vec<u8,alloc::alloc::Global>,enum2$<imap::error::Error> > > >::and_then<alloc::vec:: Vec<u8,alloc::alloc::alloc::Global>,enum2$<imap::error::Error>,imap::types::mailbox::Mailbox,imap::client::impl$7::select::closure_env$0<nat
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\core\src\result.rs:1321
   6: imap::client::Session<native_tls::TlsStream<std::net::tcp::TcpStream> >::select<native_tls::TlsStream<std::net::tcp::TcpStream>,ref$<str$> >
             at C:\Users\Nikolay\.cargo\registry\src\index.crates.io-6f17d22bba15001f\imap-2.4.1\src\client.rs:523
   7: imap_client::process_email
             at .\src\main.rs:231
   8: imap_client::main::closure$0::closure$0
             at .\src\main.rs:369
   9: imap_client::run_with_timeout::closure$0<imap_client::EmailResult,imap_client::main::closure$0::closure_env$0>
             at .\src\main.rs:145
  10: core::hint::black_box
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\core\src\hint.rs:338
Note: Some details are omitted, run with `RUST_BACKTRACE=full` for a detailed backtrace.

my code, there is an error when selecting inbox:

 if let Err(e) = session.select(“INBOX”)

Translated with DeepL.com (free version)

jonhoo commented 5 days ago

Give the 3.0.0 release candidate version a try!