Archive for September 4, 2023

Monday, September 4, 2023

Restarting macOS Apps Automatically on Crash

Alin Panaitiu (Hacker News):

Normally apps crash because of bugs introduced by the developer, but in my experience, there are cases where crashes can be out of the developer’s control. […] After we reach a certain confidence in the app stability, we can explore some ways to have the app restart automatically when the inevitable crash happens.

[…]

So with a few lines of XML, we can have launchd start our app and keep it alive on crashes.

[…]

[A signal handler] is the method I use in Lunar and Clop and it is reliable enough while also being easy to use and compatible with old macOS versions.

[…]

If the app is mostly a menubar utility sitting in background, it could be useful to detect and recover from app hangs. […] We can periodically schedule a ping on the main thread, and if the ping is not received for n seconds, an app hang happened.

Previously:

Update (2023-09-06): Quinn:

If you’re in a signal handler there’s a very limited list of stuff you can safely call. This list doesn’t include such useful things as malloc, or the Swift or Objective-C runtimes.

[…]

Think very carefully before installing a signal handler for any purpose. And if your goal is to catch crashes, read this first.

I personally do not see much risk in Panaitiu’s signal handler that only uses Objective-C to get the main bundle’s path and then start a helper task to relaunch it. That said, it could perhaps stash the path at launch and use a C function instead of Process to respawn.

DTrace at 20

Bryan Cantrill:

Two decades ago today, DTrace integrated into the operating system. Much has changed in the last 20 years -- but one thing has remained true: we ourselves still use it on a daily basis.

[…]

I reminisced a bit after the 5th anniversary (15 years ago!), describing in particular the harrowing day before we integrated.

That day continues to be memorable; @ahl and I talked about it on a recent episode of Oxide and Friends.

Ten years ago -- on DTrace’s 10th birthday -- I described some of the things that we had added to DTrace over that decade.

Nik:

Back in the day Sun ran a contest, “Try before you buy”. Get a machine (an Ultra 60, IIRC), for 60 days shipped to you free.

Blog about something interesting you did with it, enter the contest, and maybe win the machine.

I instrumented Sendmail with DTrace, evaluating different queuing strategies (along with a comparison of Solaris and FreeBSD on the machine). Found a sendmail bug along the way, and won the contest.

Previously:

Update (2023-09-06): Jeff Johnson:

It’s so sad what SIP has done to DTrace on Mac, rendered it almost useless.

iPologists always say “You can disable SIP”, but as a developer you really can’t, because then your testing environment is very different from your customers’ environment.

Testing Noise-Canceling Headphones

Andrew Marino (via Dave Mark):

The Sony WH-1000XM5 offered the best passive attenuation and very good ANC. The Sonys were an overall good noise canceler, with solid performance in all noise environments. The Apple AirPods Max were a close second and did especially well with the airplane cabin noise due to their efficient noise canceling in the lower frequency range of 100–500Hz. The Bose QC45 scored just under these headphones.

All of the headphones struggled to cancel loud environmental music — not much surprise there. That is a difficult and complicated noise to suppress. For speech quality of audio playback with all the noise environments, the AirPods Max did the best. According to the results, even with ANC set to the max, the AirPods Max did a great job of “allowing the speech playback to come through undisturbed, unaltered, and sounding natural.” So, if you’re listening to podcasts or audiobooks on your daily commute, they may be your best choice.

I guess they only tested over-the-ear models, not earbuds like AirPods Pro.

Previously:

Studio Display Firmware 17 Beta 6

Juli Clover:

Apple today released a sixth Studio Display 17 firmware beta, with the update coming a few weeks after the release of the fifth beta.

All Studio Display models are able to receive over-the-air firmware updates, but this firmware update is limited to Macs that are running the new macOS Sonoma operating system at the current time. macOS Sonoma is also being beta tested.

With no release notes and little chance of the camera being further improved via software, I don’t see the appeal of running a beta firmware for my display. I continue to have problems with the display not turning on until it’s unplugged/rebooted, but at least that problem is limited in scope and easy to work around.

Previously: