News for hackers. Stuff that matters.
Re:Kill Me Softly – Kill processes in a reliable manner by khrf on Tuesday December 16, 2014 @05:25PM (#8759978)
If you think of it from a developer's view, you'll come to conclusion that you can't create a program that doesn't need to cleanup things before termination. Unless it's very useless program that doesn't process any incoming data. That's why there is SIGTERM in operating systems.
Re:Kill Me Softly – Kill processes in a reliable manner by lomnakkus on Tuesday December 16, 2014 @05:44PM (#8760065)
That's nonsense. All ACID databases handle the requirement that a SIGKILL doesn't corrupt data. There may be a non-trivial recovery cost if you experience an unexpected shutdown, but that's about it for any application that's serious about data integrity.

EDIT: In fact they handle a much stronger requirement that a power failure doesn't corrupt data, but the point stands.

Re:Kill Me Softly – Kill processes in a reliable manner by vinceguidry on Tuesday December 16, 2014 @07:02PM (#8760363)
ACID databases can do this because they have the powerful hand of math giving them superpowers. Most developers don't.
Re:Kill Me Softly – Kill processes in a reliable manner by lomnakkus on Saturday December 27, 2014 @07:24PM (#8804566)
"powerful hand of math".

What? I did a pretty simple proof of the safety of Write-ahead Logging as an undergraduate project -- given reasonable assumptions about disks (or implementation safeguards such as pervasive checksumming).

Most developers have superpowers: It's called "existing research". I just wish they'd use them more.

Re:Kill Me Softly – Kill processes in a reliable manner by pjscott on Tuesday December 16, 2014 @07:18PM (#8760408)
Sqlite is a library that you can just link to. Use that for your state-handling, and you need not fear a thousand SIGKILLs. This is a very popular approach.

Or, if you're on a server, you can use another database. Or use atomic file writes, if you have fancy needs. If you have really exotic needs then sure, do your own thing -- but most of the time, killability is easy and beneficial.

Re:Kill Me Softly – Kill processes in a reliable manner by vinceguidry on Wednesday December 17, 2014 @10:35AM (#8762596)
If you do that, then you have to model program state not as objects, but as database rows. Have fun using ORM on all your projects, for everything.
Re:Kill Me Softly – Kill processes in a reliable manner by angersock on Tuesday December 16, 2014 @05:42PM (#8760054)
You very much can--it depends on what you're doing.

Supporting SIGTERM and certain other signals is just deciding how big a crater you want to make when the program goes down. That said, it's good practice to use things (write-ahead logging, idempotent operations, etc.) that at least try to mitigate the amount of debris.

Re:Kill Me Softly – Kill processes in a reliable manner by rdtsc on Tuesday December 16, 2014 @06:09PM (#8760171)
> That said, it's good practice to use things (write-ahead logging, idempotent operations, etc.) that at least try to mitigate the amount of debris.

Yap that are some of the things I used. Append only mode for files. Code that handle roll-back to last consistent state that runs on every startup. External monitors and watchdog that know how to monitor and to extra cleanup is necessary.

Re:Kill Me Softly – Kill processes in a reliable manner by rdtsc on Tuesday December 16, 2014 @06:02PM (#8760143)
> If you think of it from a developer's view, you'll come to conclusion that you can't create a program that doesn't need to cleanup things before termination.

Nope. I did create a lot of complicated programs that work that way. Tested, shiped and got paid for them nicely.