3 ms·
Fiber optic cables are dug up by backhoes. Hard drives randomly fail. RAM is corrupted by cosmic rays. Racks lose power. CPU fans stop spinning. If your pr
by jrockway 12y ago
Fiber optic cables are dug up by backhoes. Hard drives randomly fail. RAM is corrupted by cosmic rays. Racks lose power. CPU fans stop spinning.
If your process relies on not being kill -9'd, then you might as well quit programming and go buy a lottery ticket.
- __david__ 12y agoRight: programmers shouldn't rely on it, but neither should it be the only tool that users reach for when they want something to stop.
- vacri 12y agoThis is a bit like saying that since your car can do emergency braking, you should always do emergency braking. Some processes clean up after themselves more neatly, or finish the current run of what they're doing first. It's dependent on what it is that you're stopping.
- rbsn 12y agoHow is it anything like that?
- vacri 12y ago"Use the harshest survivable option available, regardless of whether it's the best for the situation"
- mcintyre1994 12y agoIt seems more like saying "children, cyclists, animals, other drivers. If your car can't do emergency braking you might as well stop driving and buy a lottery ticket" to me. Which IMO is pretty reasonable. They don't say anything about when to use kill -9 (all examples are outside user control) just that it should be survivable.
- al_gore 12y agoI get what you're going for, but it's pretty much openly legal to kill pedestrians with cars (in the US, at least). "No criminality suspected"!
- aaronem 12y agoThere's a little more to the United States than the city of New York. I grant it is an uncommonly large city, but it's not that large.
- Sanddancer 12y agoYes, your process shouldn't eat data on a kill -9. At the same time, in a lot of applications, kill -9 can make other things less convenient. If your app is in a cluster, that job you just kill -9'ed is now suddenly not sending out heartbeat messages, which means the servers around it are waiting, with data stacking up, wondering what happened to that process you just shot in the head. Yes, it'll recover when things come back up, but you've just added more work on the other servers. Or, that server task didn't write the last few log entries. Given you're killing jobs, those stragglers may have data as to why you needed to stop things in the first place. In short, you shouldn't kill -9 right away because well-written programs talk about their state to the programs and log files around it, and those last messages can be very useful in giving information as to what is happening with your program.
- twistedpair 12y agoI know of some PHP installs that add a cron job that kills off hung PHP processes every hour. Ain't that uncommmon.