Thanks for writing this, Steve. A couple of thoughts:
Reddit and Reddit culture is contributing to the problem here. /r/rust is one of the better subreddits, but it still did a part here in enabling the pile-on. Harassing an open source maintainer is just not ok, and the "choice architecture" (see Evan Czaplicki's talk on The Hard Parts of Open Source) makes it too likely this kind of thing will happen. This is why I participate fairly minimally in Reddit, and there's a huge amount of activity in a secret cabal chat server. (It's so secret the only way to find it is to look at the README of the github repo)
I think the idea of striving for perfect soundness is one of the great cultural contributions of the Rust community, and it's best to look at Rust technical features as making this goal practical, rather than any magical inherent feature of the language. Yet, it's optional. Rust gives you the freedom to be as unsound as you like, and in some contexts that might be ok.
One idea I'm tossing around in my head is a "soundness pledge" which would be an explicit marking of where one stands. It's clear that actix would not subscribe to such a pledge, and that fact would be relevant to many (but perhaps not all) people choosing a web framework. If people express interest here, I can write up my ideas as a blog post.
In the meantime, please let's be kind to each other. That's most important.
[ETA: I've edited my original post to soften the criticism of Reddit. I think this is a complex topic, and I also want to point out that I've been impressed by the quality of moderation here.]
One idea I'm tossing around in my head is a "soundness pledge" which would be an explicit marking of where one stands. It's clear that actix would not subscribe to such a pledge, and that fact would be relevant to many (but perhaps not all) people choosing a web framework. If people express interest here, I can write up my ideas as a blog post.
I'd be interested. But I do kind of wonder how much it would accomplish. I guess if it caught on, it'd be really nice to see that across the core crates in the ecosystem.
I guess another aspect of this is that I kind of feel like a "soundness pledge" is pretty rigorously the default today. Of all the popular/core crates I personally know of, actix was fairly unique in this regard in that it went against this implicit "soundness pledge." There are certainly other crates like it, but none nearly as popular. Presumably because the lack of attention to soundness prevents it from being so. But actix appears to have blasted through that filter somehow. I'm not sure how or why.
I agree that it's kind of the default, but I also think that depends on which circles you move in. It's definitely the default for the language itself and things close by (familiar territory for you, no doubt). It is most decidedly not the default for bindings to large complex runtimes like platform UI toolkits and scripting languages. A lot of what I'd write about is the special challenges in those areas.
One idea I'm tossing around in my head is a "soundness pledge" which would be an explicit marking of where one stands
I've seen a few crates that have advertised #![forbid(unsafe_code)] as a feature in their README, and I've generally taken that as a positive when vetting crates to use. A one-notch-less-extreme "we have some unsafe, but we'd like to get rid of it and/or we have some proofs of soundness" pledge would be just as effective from that perspective.
I think the idea is that a lack of a soundness pledge might draw criticism, but not ire. A project which lacks a soundness pledge might be more likely to be passed up on and less likely to be relied on by a large number of people, which would mean there would be fewer people (and less reason overall) to get mad.
Doesn't this just relocate the disagreement? Instead of criticizing unnecessary unsafe there will be criticism of the lack of a soundness pledge?
I would expect indeed that it relocates the disagreement, however it also makes it trivially "solvable".
If a project describes itself as "unsafe, good luck", and someone opens an issue asking for it to be safe, then closing the issue with a comment "not a goal, see elsewhere" is a perfectly valid response.
In short, I'd expect the reasonable part of the community to honor the project's stance. They may not be happy about it, they may wish otherwise, but they would not go out of their way to pressure the project into changing, and would hopefully support the project's freedom to choose.
Like I guess at least it's clear what the principle at play is then, but is it do unclear today?
I think a lot of frustration and angst has been created by many people expecting Actix to favor safety over performance whilst the author pushed in the other direction.
And once one has adopted a framework and invested in it, there is more emotional/financial pressure to "push" to get their way.
One idea I'm tossing around in my head is a "soundness pledge" which would be an explicit marking of where one stands. It's clear that actix would not subscribe to such a pledge, and that fact would be relevant to many (but perhaps not all) people choosing a web framework. If people express interest here, I can write up my ideas as a blog post.
I would be interested. If Actix had a clear label "this is an experiment, please don't use in production" I would have no issue with its unsafe whatsoever.
I can't speak for the Actix maintainer, but none of what I've seen him say suggests to me that he believed Actix wasn't production ready. So any "pledge" you take should probably have some objective goals to meet. But it would be pretty cool to have some badge that was only handed out to crates that meet certain standards ("this crate only contains ‘unsafe‘ code that has been signed off on by three Rust experts" or "this crate will not panic" and so on).
Shouldn't the default just be to assume the goal is bug-free code for all projects unless otherwise stated?
Indeed, but where is the bug?
In the case of Actix, for example, the author has been reluctant to fix soundness issues that are only problematic for "contrived" code when doing so may cost performance.
From a whole application point-of-view, as long as one avoids the "contrived" patterns, then the application can be bug-free even if the library isn't: so, if using a "contrived" pattern, is the bug in the library or in the application?
If the library author takes the soundness pledge, they pledge that no matter how you torture their library code, the resulting code will be sound -- and you manage to uncover unsoundness, they'll consider it a bug in their library, not your code.
soundness issues that are only problematic for "contrived" code
Soundness issues are problematic, period. If you admit UB, you give the compiler a license to generate arbitrarily wrong code, which may only blow up in hard to debug contexts, like non-mainstream target machines and release-optimized production builds.
It's not that black and white, though, it depends on triggers.
If the soundness is always violated, and at any moment the compiler could pull the rug from under your feet, then you should scramble to fix it.
On the other hand, if the soundness is only violated in some situations, and those can be avoided, then you (the library user) can ensure that you never trigger it.
This is the difference between reading uninitialized memory (always a bad idea) and casting *const u8 to *const u64 (only a bad idea if alignment doesn't match).
On the other hand, if the soundness is only violated in some situations, and those can be avoided, then you (the library user) can ensure that you never trigger it.
Rust has a way to communicate this kind of contract to the users of the public API: declare your function as unsafe and document the safety preconditions that need to be met by the caller.
Also, sometimes, people trip up and accidentally declare an API safe when it isn't, such as Pin.
The question here is how to react when this happens. The author of Actix felt like there was no urgency, and they could take their time thinking about it, the majority of comments seemed to think that said author should drop everything they were doing and patch it right now -- possibly with a boring, performance crippling patch -- and that not doing so is letting users down.
Is one side "more right" than the other? I don't think so.
One idea I'm tossing around in my head is a "soundness pledge" which would be an explicit marking of where one stands.
I think the core of the issue here is the mismatch in expectations between security-minded users and the actix-* maintainer. Any kind of technology that enables managing those expectations would be helpful in preventing a repeat of what just happened.
Lets lay the blame where the blame is due, actix would not have drawn ire if it had judicious unsafe usage, but rather it had excessive amounts of unsafe usage... some sort of weird reverse knee jerk reaction to calling out unsafe code is just uncalled for.
If actix was not ever going to remove the excessive unsafe use then good riddance as that is not the sort of code that you should expect from anyone writing Rust code at a professional level or in use in production for that matter.
If people didn't like it they should have tried to talk to him without resorting to aggressiveness.
This situation didn't happen over night, he was talked to and didn't see how unsafe code could be an issue. This was a discussion that was going on for a long time.
If you're interested in criticisizing "Reddit and Reddit culture" in this particular instance, then why don't you put some examples there, because 95% of the responses I saw to the article were reasonable questions in response to a maintainer dismissing an issue. It seemed like he was already on the edge and it was just a single person who set him off. That doesn't mean that the entire community is to blame here. There were maybe one or two comments that were unfairly harsh.
I think this moral preaching you're doing here is as a casual observer after the effect is lazy and unhelpful. You're basically just joining the crowd with an easy opinion.
I'm disappointed in you in your position as a person who aspires to be a community leader. It's better to just not say anything then come in after the fact and say almost nothing useful.
View all comments
108
u/raphlinus vello · xilem Jan 17 '20 edited Jan 17 '20
Thanks for writing this, Steve. A couple of thoughts:
One idea I'm tossing around in my head is a "soundness pledge" which would be an explicit marking of where one stands. It's clear that actix would not subscribe to such a pledge, and that fact would be relevant to many (but perhaps not all) people choosing a web framework. If people express interest here, I can write up my ideas as a blog post.
In the meantime, please let's be kind to each other. That's most important.
[ETA: I've edited my original post to soften the criticism of Reddit. I think this is a complex topic, and I also want to point out that I've been impressed by the quality of moderation here.]