7 ms·
Restarting macOS apps automatically on crash
- bandergirl 3y agoI expecting to see logic to detect crash loops. What happens then?
- tempodox 3y agoExactly, I wouldn't be comfortable just blindly auto-restarting an app after a crash. macOS offers a “Relaunch” button in these situations, so you can restart it interactively. That's good enough for me.
- nottheengineer 3y ago"My software crashes so often that it's worth the time to automate restarting it" is what I'd expect of a windows user. Has macOS really gotten that bad over the last few years? I remember being forced to use it a long time ago and while it was very limited and special, nothing ever crashed or was visibly buggy.
- crazygringo 3y ago100% of crashes on my M1 MBA occur in applications when accessing files over SMB network shares. One every couple of days. I have to restart about once every week or two because it borks the system completely. But when I'm not connected to an SMB drive, I don't think I've had a single crash in years. I have no idea if it's something in the SMB driver itself that's crashing, or assumptions inside of application logic that fail in certain SMB scenarios.
- nottheengineer 3y agoSMB really is hell. I write business software and our admins do what they can to avoid using it because it's very hard to know when it fails. But from a dev perspective, that's probably a driver level issue because that's where you want to handle or propagate errors instead of crashing.
- ComputerGuru 3y agoIt’s faulty app logic, assuming an io error cannot occur accessing a filesystem. They’ll also crash if you have disk issues or driver problems. The important thing is they may not even realize they’re calling into a function or routine that can access the fs for something! All io access needs to be recoverable or catchable for your app not to crash. You’d be surprised how much background fs activity there can be in apps (or indirectly triggered by apps!) all the time.
- brailsafe 3y agoThat and sandboxing effects with perhaps improperly accessed bookmark data I'm building a macos app now, and only because I wasn't catching fs access error did I realize I needed to handle folder access carefully when using bookmarks in core data.
- BeFlatXIII 3y agoI swear _Finder_ has this bug if you plug in a superannuated external HDD.
- dagmx 3y agoThis is one reason where I think Rust shines, and has even improved how I write C++. So many areas where rust makes me deal with a result or option that are easy to take for granted. It’s a strong reminder of the number of things we should be treating as possible error cases
- bpye 3y agoIt makes you do something, but if the consumer just does .unwrap() the end result is going to be the same.
- dagmx 3y agoSure, but a developer can also write any number of other code that’s irresponsible. At that point the language has done all it can for them, and the onus is on the developer to not be lazy. And when the crash happens, it’s obvious why
- pram 3y agoStuff like this with NFS was my living nightmare for years. On Linux it would put processes into the D state and you'd have to restart the entire machine to fix anything.
- dylan604 3y agoWhy is the assumption the OS is the fault and not the app doing something it shouldn't be doing so the system slaps it? If the OS was at fault, would not the OS be crashing rather than the app. To me, it sounds like the OS is working nicely with a misbehaving app. Maybe the better question would be if the OS SDK is to a state that doing naughty things is easier to do, but again, that's not the OS
- FirmwareBurner 3y ago>"My software crashes so often that it's worth the time to automate restarting it" is what I'd expect of a windows user. This is insulting even for windows users.
- fortran77 3y agoThat's why I flagged it.
- labster 3y agoYes, but it’s also funny, and not mean-spirited or targeted at a specific person. Windows users are in no way a protected class.
- FirmwareBurner 3y agoNo, it's just targeting a specific group of people with false facts, while not being remotely funny, unless your choice of humor revolves around shitting on users for their OS choice, aka petty tribalism. Humor is more complex to get right, it needs some punchline or an arc within the context where your initial expectations are subverted, in order to be funny, not just "windows users are like X".
- labster 3y agoHold up there, joke police. Petty tribalism is actually funny. It’s gross tribalism which goes too far. Listen to Garrison Keillor’s old radio shows, and amidst the long story arcs are little tribalist jokes between the Christian denominations (and Unitarians?), and among the different peoples of Scandanavia. Like this one, the jokes rely on the implicit context inflating the difference between people on the basis of tribalism. And being a part of the subculture, the audience all knows this. The same is true in sports comedy, and sports is nothing if not petty tribalism. And while you may not actually have to be a masochist to be a Mets fan… wait, bad example. Anyways exaggerated differences based on self-assigned fandoms is how this all works. Just like operating systems.
- fortran77 3y agoMacOS applications are just like applications on any other platform. Why the juvenile Windows bashing?
- brailsafe 3y agoNo they're not, otherwise we'd use those other platforms.
- fortran77 3y agoI use Windows.
- brailsafe 3y agoI also use Windows... for gaming once a week, because it provides a passable experience using my crap PC hardware. I use a mac for everything else because it lets me get work done without being distracted by how poorly text is rendered, how dated some of the icons and interfaces are, or by the fear that I'll need to re-install the operating system once in a while. For me, my Windows pc is my Chromebook with a gpu, for others, it's their primary.
- tom_ 3y agoWhich OS do you use? It sounds like it can't be Linux! Looking forward to hearing about this crash-free nirvana.
- prmoustache 3y agoThe only app that has been crashing or freeze, on my Fedora box these last few years is a Microsoft app: Edge.
- nottheengineer 3y agoArch. My PC sometimes hangs for no reason, which it also did with windows. It used to be a non-issue because it was too loud to run it overnight, but now it's quiet so I'm trying to figure that out. Every nvidia driver update has about a 10% chance to break something. That was also the case on windows so I just didn't update it there and had great success with recommending people to find a version that works and never touching it again. I don't recall ever having an issue that was fixed by restarting an application though. If it doesn't work, I read the error message to figure out why it doesn't work and fix that. No "just try again, it might work this time" like on windows, which I enjoy.
- dagmx 3y agoIf you don't know why the app is crashing, then you don't know enough to blame the OS or the ecosystem. That's true of any operating system. Apps aren't magically crash free because they're on a Mac. Dereferencing an invalid pointer can still segfault you just as quickly.
- deleted 3y ago[deleted]
- ryandrake 3y agoI’m not going to get into the Mac vs Windows flamewar but I worked at a place with this infuriating attitude about crashes. Our (desktop) application crashed so much that customers were complaining. Instead of, you know, fixing the crashes, the tech lead declared that we would instead build a “launcher” app that just sat in the background and restarted the application every time it crashed. Horrible “crashes are inevitable and hard to fix!” attitude. Talk about a morale killer.
- prmoustache 3y agosolution looking for a problem
- deleted 3y ago[deleted]
- saagarjha 3y agoOne should be careful about what they put in a signal handler. Doing complex things like calling into Foundation, especially in a signal handler that indicates something has really gone wrong, is probably not a good idea.
- cryptonector 3y agoI came here for this. Signal handlers have to do only async-signal-safe things.
- alberth 3y agoReminds my how Basecamp use to restart their Rails app 400 times/day. https://dhh.dk/posts/31-myth-2-rails-is-expected-to-crash-400-timesday https://dhh.dk/posts/31-myth-2-rails-is-expected-to-crash-40...
- cryptonector 3y ago> Bonus: restart on hang This is not good for battery life. I'm not sure how to heuristically detect hangs in a power-friendly way.
- deleted 3y ago[deleted]
- ChrisMarshallNY 3y agoI'm not really a fan of auto-restart on crash. In some cases, it could cause damage. I consider a crash -any crash, to be my fault. This includes things like yanking out the power cord (which probably will just stop the program counter, as opposed to careening off into the weeds). No matter how abusive the user is, no matter how out-of-band their behavior, my software should never crash. I love crashes. They tend to be easy to fix (of course, thread collisions are another matter). If I can reliably reproduce a crash, I can usually fix it in a few minutes. In iOS, Apple makes it impossible to quit an app. I have heard of developers deliberately forcing a crash to do that, but, if Apple catches you doing it, they'll yank the app. They won't approve apps they can get to crash. In fact, they have, in the past, found crashes that I missed. Just better off, writing software that can handle always-on, and that doesn't crash.
- deleted 3y ago[deleted]
- deleted 3y ago[deleted]
- saagarjha 3y agoCrashes are often the result of the platform behaving in unexpected ways, not users.
- notbeuller 3y agoBack in the mists of time when writing cross platform software for any platform (Mac, Win < 95, SunOS + xview) each platform had bugs and we’d have to take pains to workaround them. Our customers didn’t care whose fault it was. It used to be that a single tech support call cost us any profit from 3 copies of the product. Things are different now though - the frameworks on platforms have orders of magnitude more surface and complexity. And most small companies don’t offer 1-1 support anymore.
- ChrisMarshallNY 3y agoIn my experience, crashes are usually my error. Swift helps a lot. It has a lot of safety in it. I haven’t had a memory leak in ages. Also, Xcode has gotten really good at letting me know when I have a future crash.
- pixel_tracing 3y agoI don’t suggest this. Your application may crash due to: - hangs / spins - memory corruption - programmer error / faulty logic (think loooping infinitely) - thermals / memory usage Let launchd handle restarting your application by allowing the user a “Relaunch” button
- tedunangst 3y agoOr maybe you've been signed up for free fuzzing by your local government security service. Restarting the app so they can continue probing is only courteous.
- m3kw9 3y agoProb take longer to get out of a crash loop than to just cdm-space and type first 2 letters of the app name and enter.
- alin23 3y agoGreat comments everyone! Really nice hearing from all these devs experienced with writing crash free apps that never crash with inscrutable tracebacks which after days of investigation turn out to be caused by a DisplayLink driver. It’s refreshing to see your users never angrily contact you to fix crashes you can’t fix and that your only answer is not “sorry you will have to just relaunch the app” Your unfounded assumptions are a delight, indeed I must be doing something wrong and maybe just didn’t put in the work into fixing these errors, and after 6 years of developing the same app and looking at the Sentry dashboard every day and talking to users through email/Discord/Twitter/Reddit/forums and looking at their video recordings and deciphering their explanations and sending them betas and custom utilities that definitely reproduce how the crash is not a user error… sorry, what was I saying? God damn it man, it’s this thing every day here. I just wanted to share a readily made solution for people that are in desperate need of it and have exhausted all other possibilities. I’m not trying to make everyone create crash loops and bringing systems to a grind.
- asplake 3y agoThe developers of Kindle for Mac might want to read this