-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Propagate panics harder #14
Conversation
I don't think this is necessary. We rethrow the panic, so from the perspective of a user of this crate, it's as if the catch_unwind didn't exist. Is there something I'm not thinking of? |
Oh, sorry, to clarify, this is fixing the SIGILL on travis It looks like SecureTransport writes twice before returning back for the panic to get propagated? Somehow the runtime is detecting a double panic. |
The SIGILL is a thing that's weird, but it seems to me like some kind of issue with libstd. IIRC it popped up after some of those optimizations made to the panic runtime a couple weeks ago. Specifically, it shouldn't matter if secure transport tries to write twice, since we catch the panic each time. If the panic runtime isn't decrementing the panic count when a panic is caught, that seems bad. |
The change in question was likely rust-lang/rust#34866, but I disagree that this change isn't needed. With panic safety we shouldn't come back to call
The |
Ah, that does make sense. I think I'd kind of prefer to only have the We could alternatively not call SSLClose in Drop at all. It won't work in a nonblocking context and it might make more sense to have people opt-into an orderly session shutdown rather than doing it by default. IIRC rust-openssl doesn't do a shutdown in its destructor, but schannel-rs does :(. We should figure out a consistent story here and make sure everything's doing the same thing. |
Ah yeah I'd imagine that |
6d8a3bd
to
cc8ab4f
Compare
Ok, updated a bit with an Is that what you're thinking? |
Let's cut the change to |
Hm right yeah that's true, I think that with propagation it's ok to re-poke. The C side though was intended to abort quickly b/c it's a bug to reenter. Would you prefer though if they just immediately returned |
It's only a bug if we do it without the user's permission (i.e. the Drop use case). If the user wants to start calling read/write again, that seems like a thing that should work. |
Once a `Connection` has panicked in I/O it's effectively poisoned and we shouldn't come back to it in the destructor, so skip `SSLClose` in this case.
cc8ab4f
to
e2f0dc8
Compare
Ok, updated. Slowly getting my head straight around this again... |
Thanks! |
Once a
Connection
has panicked in I/O it's effectively poisoned and weshouldn't come back to it (due to a lack of
UnwindSafe
bound). Set aflag on
Connection
and bail early before we access the stream.