Persistent Console Process

I have a console controller instance whose lifetime will be managed via upstart (linux) that implements a persistent background job processor.

Testing on PHP 5.5.23 on Yosemite 10.10.3, Yii 2.0.3

After I do a Model::find() call the KILL signal doesn’t terminate the process.

Ctrl C kills the process if I just have a loop with a sleep(1).

Looks like after a DB operation is executed ctrl-C no longer KILLs the process, the loop continues.

I also tried implementing pcntl_signal(SIGTERM, [$this,“sig_handler”]) and doing a kill -s TERM on the process, it dies but with a ‘segmentation fault: 11’

What’s happening there - what’s preventing the process from being killed?

Ctrl-C kills process:




while(!$this->stop)

        {

            Console::output('loop');

            sleep(1);

        }



Ctrl-C no longer kills process




ActiveRecordClass::findOne(1);

while(!$this->stop)

        {

            Console::output('loop');

            sleep(1);

        }