I'm trying to kill a phantom but it won't die

The phantoms poll a record in a database file and if it exists, the phantom dies.  This ensure a clean death of the phantom.   You may kill the phantom using the bpi.form.admin command either using the command-line interface or the bpi.form.admin.sub API call.

If the phantom does not respond to the issuance of a kill request from the command-line or api, then it could be in a defunct state.  Since the phantom does a lot of sleeping in between iterations, there is a possibility on some systems that if you change the system clock backwards when the phantom is sleeping, that the phantom will remain sleeping.  This is because the wake-up time for the phantom is calculated by taking the current clock time then adding the sleep interval to it.  This computes a 'wake-up time'.  However, if you set the clock backwards while the process is sleeping, the wake-up time may now be far in the future and the phantom will remain sleeping until that time. 

For this reason, it is advised to terminate the phantoms before setting the system clock backwards.

If all else fails, you can kill a comotose phantom with the kill -15 <pid> directive.