views:

409

answers:

2

I am working on a CRON job in PHP which has to do a lot of heavy lifting via the database. Think lots and lots of 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 simple "Killed" message. 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
I'm leaving _getMemberDemographicAttrs
I'm in _getMemberDemographicAttrs
I'm leaving _getMemberDemographicAttrs
I'm in _getMemberDemographicAttrs
Killed

I've never seen this generic "Killed" error message and I'm wondering what is dying.

+5  A: 

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.

Steve Madsen
A: 

How calls this method? You don't need clean array $rules in new interaction? What is the size of this array?

Felipe Cardoso Martins