EmbarkStudios / crash-handling

Collection of crates to deal with crashes
Apache License 2.0
138 stars 13 forks source link

Filter out exceptions not meant for the current task on macOS #32

Open gabrielesvelto opened 2 years ago

gabrielesvelto commented 2 years ago

On macOS the child process fork()-ed from a parent which had set a handler for the exception ports will inherit the handler. This can lead to exceptions for a process being delivered to a different one, forcing the exception handler to manually forward exceptions. Additionally it's possible to forward the exceptions that aren't handled or expected to the system exception handler so that macOS can pop up its own crash reporter for those cases. We do this magic dance (see here, here and here) in Firefox' modified Breakpad handler. Note that a large chunk of that is generated via an Apple script (as described here) and then modified for our use. In my experience the script generates different code in different versions but it usually "just works" across all of them.

I'm not sure where this machinery could fit but I'm filing this issue so that it's documented and I don't forget about it.