sentry-rust icon indicating copy to clipboard operation
sentry-rust copied to clipboard

Panic when system is out of resources (unwrap)

Open jrray opened this issue 2 years ago • 2 comments

https://github.com/getsentry/sentry-rust/blob/96e1da3d4d5d4197899cab8cfdcfcdb672689e65/sentry-core/src/session.rs#L228

We're seeing processes fail with this message:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { 
code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', 

<snip>/sentry-core-0.27.0/src/session.rs:228:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Unfortunately I do not have a full backtrace at this time.

jrray avatar Nov 30 '22 21:11 jrray

This happens in the startup path (or when manually cloning a Client).

Sentry does need to spawn two background threads. This SessionFlusher, and one for the configured Transport.

I’m wondering what "system is out of resources" means? As this happens in the startup sentry::init path, your system should not be overloaded yet, compared to its main runtime.

Or do you have some restrictions on thread spawning in general? If so, do you have a custom transport that avoids spawning threads? Or why isn’t it complaining when spawning the transport thread?

Swatinem avatar Dec 01 '22 09:12 Swatinem

This is a process running on a render farm where the host may be already heavily loaded by other processes. I'm trying to get a stacktrace but knowing this is likely happening in sentry::init helps. I'm not really asking for sentry to not fail is this situation, but would prefer this ended up as a Result in my code instead of a panic. But I can handle the panic on the sentry::init call.

jrray avatar Dec 01 '22 19:12 jrray