Generic "Killed" error in PHP script

Viewed 33227

I am working on a CRON job that invokes a PHP script which does a lot of database work with loops.

It executes properly when I limit the data set, but when I run it against the full data set, the script errors out with a message:

Killed

set_time_limit is (0) and memory_limit is (-1)

Here is the code section where it consistently dies:

echo "I'm in _getMemberDemographicAttrs\n";
if (! empty ( $member_id )) {
    $query .= ' AND member_id = ' . $member_id;
}

$result = mysql_query ( $query, $this->_db );
if ($result) {
    while ( $rule = mysql_fetch_assoc ( $result ) ) {
        $rules [] = $rule;
    }
    if (! empty ( $rules )) {
        mysql_free_result ( $result );
        echo "I'm leaving _getMemberDemographicAttrs\n";
        return $rules;
    }
}

The output looks like this:

I'm in _getMemberDemographicAttrs<br/>
I'm leaving _getMemberDemographicAttrs<br/>
I'm in _getMemberDemographicAttrs<br/>
I'm leaving _getMemberDemographicAttrs<br/>
I'm in _getMemberDemographicAttrs<br/>
Killed

I've never seen this generic Killed error message and I'm wondering what is causing it to be killed?

3 Answers

You might be triggering the Linux out-of-memory (OOM) killer. Check dmesg for messages about it. It says which process was killed when this happens.

In my case on CloudLinux, PHP 7.1, it occurred when 2 processes were reading and writing to the same file without locks.

Related