2

I'm running really long task in php. It's a website crawler and It has to be polite and sleep for 5 seconds each page to prevent server overloading. Script starts with:

ignore_user_abort(1);
session_write_close();
ob_end_clean();
while (@ob_end_flush());
set_time_limit(0);
ini_set('max_execution_time',0);

After few hours (between 3-7h) script dies without any visible reason. I've checked

  • apache error log (nothing)
  • php_errors.log (nothing)
  • output for errors (10 578 467b of debug output, no errors)
  • memory consumption (stable, around 3M from memory_get_usage(true) checked every 5 sec, limit set to 512M)

It's not browser, cause I was using wget and chrome to check with the similar reason. Output is sent to browser every 2-3 seconds, so I don't think that's the fault + I ignore user abort.

Is there any other place I can check to find the issue?

4

1 回答 1

0

我认为脚本的其余部分存在问题,而不是 Apache。

尝试使用register_tick_function和像这样的光分析器来分析您的应用程序并记录内存使用情况,可能就是这样。

于 2012-08-30T11:03:03.297 回答