Ich habe ein PHP Scrip auf einem Testserver laufen. Dieses verarbeitet XML Dateien. Für jede XML Datei wird per Exec ein neues PHP Script im Hintegrund gestartet.
Jetzt bekomme ich die Meldung das der Arbeitsspeicher voll ist. Ich hab dann mit sar geschaut, dort sieht aber alles gut aus. Wo kann ich noch schauen?
Ich lasse mir im PHP Script schon mit ps aux ermitteln wieviele Scripte ich schon gestartet habe und warte zur Zeit nach 20 Scripten mit Sleep(10) bis es wieder weniger als 20 Scripte sind.
Meldung von etwa 16:28 Uhr :
grep: write error
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/curl.so' - /usr/lib/php5/20100525/curl.so: cannot apply additional memory protection after relocation: Cannot allocate memory in Unknown on line 0
/proc/uptime: Nicht genügend Hauptspeicher verfügbar
sh: 0: Cannot fork
sh: 0: Cannot fork
16:00:13 kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact
16:05:02 910160 662704 42,13 0 65212 0 0,00 447316 195916
16:15:03 969328 603536 38,37 0 76432 0 0,00 301924 281280
16:35:02 938760 634104 40,32 0 72272 0 0,00 375072 241796
16:45:01 1327796 245068 15,58 0 76580 0 0,00 176376 58276
16:55:01 1414840 158024 10,05 0 78524 0 0,00 87020 61588
17:05:01 1414832 158032 10,05 0 78528 0 0,00 85760 62868
17:15:01 1411552 161312 10,26 0 81252 0 0,00 82992 68036
[...]
if(run_check("db_update_spiel_thread.php")>$max_anzahl_threads){
sleep(10);
$b--;
}else{
//echo "ID:".$id_liga."\n";
shell_exec($dir."/thread/db_update_spiel_thread.php ".$uebergabe." >> ".$dir."/log/db_update_spiel_goalserve_thread.log 2>&1 &");
}
[...]
function run_check($runningScript){
if( !empty($runningScript) ) {
// Pruefe wie oft das Hauptscript schon laeuft
// Alle weiteren Ausgaben werden dabei ignoriert
$output = shell_exec("ps aux | grep {$runningScript} | wc -l");
// Ergebnis groesser 1: Script laeuft bereits
// 1 wird immer geliefert, da das Script sich selbst auch sieht, daher minus 1.
return (int)$output-1;
}
}