Live data from Hacker News

Everything Is Broken: Shipping Rust-Minidump at Mozilla

hacks.mozilla.org

31–40 of 67 posts

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

#31
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.

You're probably remembering https://pernos.co/blog/tzcnt-portability/

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

#33
post #24

Earlier quoted context omitted.

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…

> you can't trust that your enums have a value inside their interval If you don't set the underlying type, assigning a value that doesn't match an enumerator via `static_cast` is undefined behavior. See https://en.cppreference.com/w/cpp/language/enum . (Doing weird pointer casting things is also undefined behavior per the strict aliasing rule, though, come to think of it, I'm not sure whether memcpying an out-of-rang…

Even if that covered all the problem space (instead of replacing it with a much larger one), if your code is flawless, parsing and validating are equivalent.

Choosing one just makes a difference because code has problems.

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

#34

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

Mmm. I think @m_ou_se is probably the most entertaining at least if we consider that both Saturday Night Live and Nightmare On Elm Street is entertainment.

For example, Rust deliberately doesn't have the tertiary operator, and random other types don't get silently coerced as booleans - so you can't write a = x ? 1 : -1; however you can write a = if x != 0 { 1 } else { -1 }; with the same effect. But Mara isn't satisfied with this verbose yet sensible answer, and proposes you could instead, for example:

a = x.count_ones().count_ones().count_ones().count_ones() as i32 * 2 - 1;

Hilarious? Or maybe terrifying? Entertaining certainly. https://twitter.com/m_ou_se/status/1404034056405368833?lang=...

Aria is more informative but I'm not going to end up choking and spilling my beverage all over the desk.

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

#35
Huh, wow, I used breakpad/minidumps daily when I was at Google working on Chromecast based things. I had no idea it existed outside that ecosystem.

Now I know there's nice Rusty work happening with this stuff that I could maybe make use of for my next employer or a personal project. Neat.

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

#36
post #21

Thank you for this work! I've been involved with minidumps in one way or another since around 2010. Was at a startup at the time that had a browser based on Chromium and we needed crash reporting for our own app. So I wrote a pretty simply backend that received minidumps, ran them through the breakpad processor and shoved the output into Splunk. That was our crash-reporting system. Circa 2013 the company gets acquire…

I was recently looking into CoffeeCatch for Android. Are you saying that I'm losing my time? :-)

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

#37
post #36
post #21

Thank you for this work! I've been involved with minidumps in one way or another since around 2010. Was at a startup at the time that had a browser based on Chromium and we needed crash reporting for our own app. So I wrote a pretty simply backend that received minidumps, ran them through the breakpad processor and shoved the output into Splunk. That was our crash-reporting system. Circa 2013 the company gets acquire…

I was recently looking into CoffeeCatch for Android. Are you saying that I'm losing my time? :-)

That may work for your own code which you can pepper with macros, but I needed to be able to capture crashes in native code I didn't write. Android itself has used a variety of unwinders over the years. Extracted versions of the libraries that have been modified to build with the NDK are here:

https://github.com/ivanarh/libcorkscrew-ndk

https://github.com/ivanarh/libbacktrace-ndk

https://github.com/ivanarh/libunwind-ndk

https://github.com/ivanarh/libunwindstack-ndk

Along with a wrapper that can use all of them:

https://github.com/ivanarh/ndcrash

It's been a while since I dealt with this and I don't recall why Android keeps changing unwinders. Looks like Sentry is using libunwindstack-ndk (well a fork of it anyway) on Android:

https://github.com/getsentry/sentry-native/tree/master/exter...

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

#38
I wonder how much of the benefits comes from the rewrite itself and not Rust. I have taken really bad hard to maintain very large code bases written in C++ and step-by-step refactored it into bug free maintainable code. In my experience bad code written in any language is hard to maintain. And good code written in any language is easy to maintain. I have worked with C code that was a joy to maintain and C code that was hell on earth. The difference was the skill of the original developers not the C language itself. Rust is a nice step forward but it is not magic. If it becomes popular enough then people will write massive impossible to maintain code in it. It is inevitable. The same goes for microservices BTW. A friend of mine is deep in coding hell trying to maintain a 20 years old 100+ microservices system. There ain’t no silver bullet.

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

#39

I wonder how much of the benefits comes from the rewrite itself and not Rust. I have taken really bad hard to maintain very large code bases written in C++ and step-by-step refactored it into bug free maintainable code. In my experience bad code written in any language is hard to maintain. And good code written in any language is easy to maintain. I have worked with C code that was a joy to maintain and C code that w…

There are entire classes of bugs that cannot happen in (safe) Rust that can still happen in a “bug free” C++ code based. You’re correct that Rust isn’t a panacea, but it does eliminate certain concerns that C++ just can not remove from thought while developing with it.

The great thing about Rust is that it reduces the knowledge and skill a developer needs in order to write a stable and (usually) performant program. This is a good thing.

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

#40

I wonder how much of the benefits comes from the rewrite itself and not Rust. I have taken really bad hard to maintain very large code bases written in C++ and step-by-step refactored it into bug free maintainable code. In my experience bad code written in any language is hard to maintain. And good code written in any language is easy to maintain. I have worked with C code that was a joy to maintain and C code that w…

Original rust-minidump author here: I started out by doing a pretty straightforward port of Breakpad into Rust, which I had just started learning at the time. I figured that learning a new language by porting a codebase I was intimately familiar with for a content area that I knew extremely well would make it so only the new language was the hard part. (It worked out well!) I did try to make the API more idiomatic Rust in places, since there are parts of Breakpad's API that are fairly C++-centric. I was also using Rust 1.0 originally, so it didn't quite have all the niceties available in the current Rust release.

All that being said, I would choose Rust over C++ for any new development anywhere. If my boss told me we had to use C++ for a new project I would actually quit. I've worked on plenty of C++ codebases (including Firefox) in my career. Sure, you can write bad code in any language, but C and C++ are just bad languages.

(I also ported Mozilla's sccache tool from the original Python implementation to Rust, which was a fun exercise. The Rust version is in production use in a wide variety of places, and AFAIK is still the only ccache-like tool that can cache Rust compilation.)

Post reply on HN