Php cli script freezes without messages

I wrote a PHP script that works through SSH and nohup, designed to process and do records from the database (for example, process some images, update some lines).

It works great under light loads, possibly up to 10 thousand records. I have several larger data sets that process about 40 thousand records (not so much, I understand, but it adds a lot of work when each record requires loading and processing up to 50 images).

Large data sets can take several days. Sometimes I see in my memory errors debugging errors that are clear enough - but sometimes the script just “dies” or zombies on me. My debug log tail just stops, without error messages, the nohup log tail ends without errors, and the process still appears in the ps list, looking like this:

  26075 pts / 0 S 745: 01 / usr / bin / php. / Import.php
but the work is not done.

Can someone give me some ideas on why the process just stops? Explicit things (like php script timeout and memory issues) are not a factor as far as I can tell.

Thanks for any advice.

PS - this is posted on VAD Godaddy (and not on my choice). I kind of suspect that godaddy has some restrictions that may attack me, despite the fact that I override in the code (for example, set_time_limit (0);).

+3
source share
1 answer

Most likely an OOM killer . If you really, really really want to stay out of reach as root , write -17to /proc/self/oom_adj. Caution: The kernel, as a rule, knows better. Dodging an OOM killer can actually distort the same DBMS you are trying to request. What a vicious circle would be :)

, , , /proc/loadavg /proc/meminfo. , , :)

, IOWAIT. /proc/stat . , .

, , OOM, , .

, cron ulimit ed . , , , ( ) - .

, , , . , , VPS ( ), , .

+2

Source: https://habr.com/ru/post/1743735/


All Articles