Live data from Hacker News

Everything Is Broken: Shipping Rust-Minidump at Mozilla

hacks.mozilla.org

11–20 of 67 posts

Re: Everything Is Broken: Shipping Rust-Minidump at Mozilla

#11
post #9

> Rust is a really good language for writing parsers. C++ really isn’t. One thing I appreciate about writing Rust is that ADT support implies writing parsers is simpler under the "parse don't validate" mindset (which was clarified for me I think in this [0] article). [0]: https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-va...

It's not ADT, it's strict types. The reason you can't do "parse, don't validate" in C++ is because you can't assume anything is valid at the point you use the data.

What ADT does is give you enough flexibility so that a strict typing system doesn't suck.

Re: Everything Is Broken: Shipping Rust-Minidump at Mozilla

#12

Gankra is the most entertaining Rust author (Rust programmer who writes about Rust). Easily.

There's an unreasonably grumpy commenter below that disagrees, but I personally agree with you and found this to be a fun read.

I was interested in the topic before reading, but it could have easily been a slog of technical minutia. I'm glad that wasn't the case!

Edit: the comment I referenced was deleted in the time I took to post this. It's probably for the best

Re: Everything Is Broken: Shipping Rust-Minidump at Mozilla

#14
post #9

> Rust is a really good language for writing parsers. C++ really isn’t. One thing I appreciate about writing Rust is that ADT support implies writing parsers is simpler under the "parse don't validate" mindset (which was clarified for me I think in this [0] article). [0]: https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-va...

It's not ADT, it's strict types. The reason you can't do "parse, don't validate" in C++ is because you can't assume anything is valid at the point you use the data. What ADT does is give you enough flexibility so that a strict typing system doesn't suck.

> you can't assume anything is valid at the point you use the data.

Just to double check my understanding: are you talking about raw pointers (i.e. void*) being common in C++ and not in Rust? You're right that I was using ADT a bit loosely; to be honest the main value add for me has been the first class data-holding enums/sum types. C++ has std::variant, but the syntax support in Rust feels nicer.

Re: Everything Is Broken: Shipping Rust-Minidump at Mozilla

#15

Earlier quoted context omitted.

It's not ADT, it's strict types. The reason you can't do "parse, don't validate" in C++ is because you can't assume anything is valid at the point you use the data. What ADT does is give you enough flexibility so that a strict typing system doesn't suck.

> you can't assume anything is valid at the point you use the data. Just to double check my understanding: are you talking about raw pointers (i.e. void*) being common in C++ and not in Rust? You're right that I was using ADT a bit loosely; to be honest the main value add for me has been the first class data-holding enums/sum types. C++ has std::variant, but the syntax support in Rust feels nicer.

C++ has a series of issues.

You can't trust pointers have a value, or that the value is valid, you can't trust that your enums have a value inside their interval, or in fact you can't trust that any value from any type is inside its interval at all.

You also can't really trust that your values have the correct size.

We choose some of those to ignore, otherwise we wouldn't be able to program at all, but C++ gives you no guarantees at all about anything. The point is that if you do a parsing run in C++ and encode your value, you will still get many of the above problems because of bugs in your code.

Re: Everything Is Broken: Shipping Rust-Minidump at Mozilla

#16
post #6

Maybe I'm missing something, but they ported from C++ (because 'C++ is bad donchaknow') to Rust and still ran into problems parsing crash dumps? If the dump is corrupt then just stop trying to parse/make sense of it; it's garbage.

No we removed many random crashes that the C++ code had. You cannot "simply" discard a crash report if something is slightly off because then you would discard most crash reports. And most debuginfo too. You can't expect "thing that runs when a process may have just experienced memory corruption" and "all builds of your application for all eternity" and "every toolchain you ever built your program with for all eterni…

Reminds me of "Your program shouldn't have bugs in it isn't an acceptable position to take for a debugger", from the rr folks. Unfortunately I can't find the source of the quote any more, but it stuck in my mind.

Re: Everything Is Broken: Shipping Rust-Minidump at Mozilla

#17
post #16
post #6

Earlier quoted context omitted.

No we removed many random crashes that the C++ code had. You cannot "simply" discard a crash report if something is slightly off because then you would discard most crash reports. And most debuginfo too. You can't expect "thing that runs when a process may have just experienced memory corruption" and "all builds of your application for all eternity" and "every toolchain you ever built your program with for all eterni…

Reminds me of "Your program shouldn't have bugs in it isn't an acceptable position to take for a debugger", from the rr folks. Unfortunately I can't find the source of the quote any more, but it stuck in my mind.

Yeah computing backtraces in a crashreporter is extremely similar to a debugger in that you need a lot of fudge-factor heuristics and fallback modes for known toolchain bugs or common corruptions.

Re: Everything Is Broken: Shipping Rust-Minidump at Mozilla

#18

It's linked at the bottom of the article, but reminder that Gankra's blog ( https://gankra.github.io/blah/ ) has a ton of other great writing like this. In particular, I always recommend "Text Rendering Hates You."

I link that article every time I see someone on the internet say “that sounds easy, why don’t you just”

And the answer is always well, things are more complicated than they look. Even something as trivial as rendering text on a screen.

Re: Everything Is Broken: Shipping Rust-Minidump at Mozilla

#20
What a fun read! :3 I really like your writing style. Deploying stuff to production is always so nerve-wracking, I related to that very hard. I recently developed a golang alternative to an old erlang-ruby-hodgepodge, and when it worked in production I found myself constantly not believing that nothing went wrong.
Post reply on HN