| ▲ | dzonga 3 hours ago | ||||||||||||||||||||||||||||||||||
> thread fl2_worker_thread panicked: called Result::unwrap() on an Err value I don't use Rust, but a lot of Rust people say if it compiles it runs. Well Rust won't save you from the usual programming mistake. Not blaming anyone at cloudflare here. I love Cloudflare and the awesome tools they put out. end of day - let's pick languages | tech because of what we love to do. if you love Rust - pick it all day. I actually wanna try it for industrial robot stuff or small controllers etc. there's no bad language - just occassional hiccups from us users who use those tools. | |||||||||||||||||||||||||||||||||||
| ▲ | jryio 3 hours ago | parent | next [-] | ||||||||||||||||||||||||||||||||||
You misunderstand what Rust’s guarantees are. Rust has never promised to solve or protect programmers from logical or poor programming. In fact, no such language can do that, not even Haskell. Unwrapping is a very powerful and important assertion to make in Rust whereby the programmer explicitly states that the value within will not be an error, otherwise panic. This is a contract between the author and the runtime. As you mentioned, this is a human failure, not a language failure. Pause for a moment and think about what a C++ implementation of a globally distributed network ingress proxy service would look like - and how many memory vulnerabilities there would be… I shudder at the thought… (n.b. nginx) This is the classic example of when something fails, the failure cause over indexes on - while under indexing on the quadrillions of memory accesses that went off without a single hitch thanks to the borrow checker. I postulate that whatever the cost in millions or hundreds of millions of dollars by this Cloudflare outage, it has paid for more than by the savings of safe memory access. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| ▲ | lmm 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
> Rust won't save you from the usual programming mistake. Disagree. Rust is at least giving you an "are you sure?" moment here. Calling unwrap() should be a red flag, something that a code reviewer asks you to explain; you can have a linter forbid it entirely if you like. No language will prevent you from writing broken code if you're determined to do so, and no language is impossible to write correct code in if you make a superhuman effort. But most of life happens in the middle, and tools like Rust make a huge difference to how often a small mistake snowballs into a big one. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| ▲ | tptacek 3 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
What people are saying is that idiomatic prod rust doesn't use unwrap/expect (both of which panic on the "exceptional" arm of the value) --- instead you "match" on the value and kick the can up a layer on the call chain. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
| ▲ | metaltyphoon 3 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
> Well Rust won't save you from the usual programming mistake This is not a Rust problem. Someone consciously chose to NOT handle an error, possibly thinking "this will never happen". Then someone else conconciouly reviewed (I hope so) a PR with an unwrap() and let it slide. | |||||||||||||||||||||||||||||||||||
| ▲ | Klonoar 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||
> I don't use Rust, but a lot of Rust people say if it compiles it runs. Do you grok what the issue was with the unwrap, though...? Idiomatic Rust code does not use that. The fact that it's allowed in a codebase says more about the engineering practices of that particular project/module/whatever. Whoever put the `unwrap` call there had to contend with the notion that it could panic and they still chose to do it. It's a programmer error, but Rust at least forces you to recognize "okay, I'm going to be an idiot here". There is real value in that. | |||||||||||||||||||||||||||||||||||
| ▲ | dzonga 3 hours ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||
other people might say - why use unsafe rust - but we don't know the conditions of what the original code shipped under. why the pr was approved. could have been tight deadline, managerial pressure or just the occasional slip up. | |||||||||||||||||||||||||||||||||||