Skip to content

Process::kil() not killing service process properly #6

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. sending a message
2. waiting for the PushMonitor to kill the service process


What is the expected output? What do you see instead?
Expect the service process to be killed, instead app just hangs


What version of the product are you using? On what operating system?
Debian 

Please provide any additional information below.

I suspect the code in process::kill() which seems to have been copied from the 
PHP docs doesn't get the child process IDs from the 
parent PID correctly.

The line :

$pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`);

makes no sense to me as the preg split should surely be on the output of the 
command 'ps -o pid --no-heading --ppid $ppid' not the 
command line itself.

Is there a reason we need to find child PIDs? From what I can see the 
PushService.php file doesnt open any child processes.

Ive replaced the function with the following code which works for me:

    public function kill()
    {
        global $debug;

        $status = proc_get_status($this->pointer);

        print_r($status);

        if($status['running'])
        {
            if($debug)
                echo 'proc is running...closing pipes.';

            fclose($this->pipes[0]);
            fclose($this->pipes[1]);
            fclose($this->pipes[2]);

            $ppid = $status['pid'];         

            proc_terminate($this->pointer);

            return (proc_close($this->pointer) == 0);
        }
         }


I'm not sure if I need the proc_close condition on return.



Original issue reported on code.google.com by mikey...@gmail.com on 28 Aug 2009 at 11:54

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions