Controller functions are thread cancellation points, so register a cancellation handler cleaning up job data.