Open cstrahan-blueshift opened 3 years ago
(Got pinged, so I'll just chime in, I don't know anything about this project in particular.)
Reusing a client with a runtime that starts up and shuts down is indeed causing that panic. If you don't want to deal with async at all, you could consider replacing your usage with reqwest::blocking
, which takes care of having the async stuff run in a single runtime, and exposes all methods as regular blocking ones.
@seanmonstar Thanks for confirming (and for your work on your libraries)! And thank you @RoxasShadow et al for this library :slightly_smiling_face: .
We're currently working around this by not reusing the same client. With this confirmation, I could look into switching this lib over to using reqwest::blocking
(time permitting).
Can't switch to reqwest::blocking
, because it's possible that Rollbar client will be used within a Tokio runtime, and reqwest::blocking
starts its own Tokio runtime, which would result in errors like: https://github.com/seanmonstar/reqwest/issues/1017
I believe we're running into a manifestation of this panic in
hyper
: https://github.com/hyperium/hyper/issues/2112See the following Rollbar payload:
We have an Actix app (the
actix::init_application
in the trace) that at the very start doesreport_panics!
, and then when an error occurs during any of the endpoint handlers we do:We aren't using
hyper
anywhere else, aside from indirectly throughrollbar-rs
, so from what I can gather from the above trace, therollbar.build_report()...send();
code panics withinhyper
with thedispatch dropped without returning error
message, and that panic is caught in the hook set up byreport_panics!
and then successfully sent to Rollbar.In the aforementioned
hyper
issue, @seanmonstar states (IIUC) that this panic can arise when thetokio
executer drops the background tasks spawned by thehyper
client before those tasks have managed to determine if the connection was closed, and that this can happen when the client is used from multiple executers.I see in https://github.com/RoxasShadow/rollbar-rs/blob/b4ad68a3b5ae575e442e1e202de39761875954bb/src/lib.rs#L521-L537
Maybe there's something about how the client is used in conjunction with
tokio
'scurrent_thread::Runtime
that's not safe when using the same rollbar client (which then in turn means reusing the samehyper
client)?