PHP Fatal error: Maximum execution time of 30 seconds exceeded in Unknown on line 0

In the logs you receive such records "PHP Fatal error: Maximum execution time of 30 seconds exceeded in Unknown on line 0" and the server hangs on ssh/ftp is not comes but ping responds. Stalkivalsa if anyone with such miracles? Server Apache/2.2.3 (CentOS), PHP 5.3.10
October 8th 19 at 03:29
7 answers
October 8th 19 at 03:31
I can assume that you have the script falls into recursion, sticks, Apache starts magically to forkutsa to meet the demands of new processes as well stick, the system loses epochal resources (memory and CPU time), many things get in the swap, other processes are not capable such as ssh, ftp due to the absence of resources. Apache also stands as fork stops working. After some time the script is killed by the Apache-fork for max_execution_time, resources returns, the sun becomes brighter, the sky bluer, ssh faster. Something like that. Total: very heavy script is detected.
How can I find the code where this is happening? How to localize the error? The project is very large and the code was not written by me... - Anthony.Considi commented on October 8th 19 at 03:34
Well, you maniac, if you have to add the packages fly, you can write a book about the work of the web server in an artistic style.
If the script worked before the recursion and infinite loops are eliminated. Remains only that data became more and in 30 seconds they don't have time to be processed. A way to simplify/divide. - Kelsi_Stoltenberg commented on October 8th 19 at 03:37
Hard to say without knowing the project, as a option to put exit() before the anticipated difficult piece (the scientific method). Then after, to see the result, but keep in mind that if there isn't includes).
Just look in Your logger, maybe there is a mistake in the derivation line, it would be great help. - Kelsi_Stoltenberg commented on October 8th 19 at 03:40
If you are looking for the decision "in a forehead", then to find out what's going on, I recommend to put xDebug on the server (forgive me followers hightload), in ini:
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /tmp
xdebug.profiler_output_name = cachegrind.out.%t

To install KCacheGrind or WinCacheGrind to load cachegrind.out.* from the server and... to see a full report of who, what, where and how many times. BUT until xDebug cachegrind will aggregate.out.* performance will fall hundreds of times. Could get worse, so do this during minimum load or on a test bench. - salma.Stroman commented on October 8th 19 at 03:43
Yet another dark mojo, not understandable hitherto normal PHP-mages, but much more efficient — DTrace ( Only a true Sith know how to make it with Apache.
Also forgot to mention that on with the xDebug cachegrind.out.* will be awarded tons of kilobytes of ROM. Disk space will flow like a recruit with enuresis. GL! - salma.Stroman commented on October 8th 19 at 03:46
October 8th 19 at 03:33
Complement the previous post, the distinguished Aco
Judging by the symptom really the system is terribly lacking resources.
— Not the fact that if it worked before then there is no recursion. Error in logic + incorrect information = infinite recursion.
What I can advise:
— Play around with memory_limit. It can help to find the "weak link" because recursion is usually cherevato eating system resources
And of course brutal porn the debug in the test envoirment. The only way you will be able to understand the logic of someone else's code and find the bottleneck
October 8th 19 at 03:35
View more access log that preceded the fall, which requests. Perhaps it will certainly stimulate some thought.

It is important to understand the periodicity of the problem. This is due to the number of users (resp. lack of resource) or by entering a search robot or rare but "accurate" challenge full of hard functions (for pericoloso cache import large amount of data, etc.)
October 8th 19 at 03:37
Try set_time_limit(0);. If does not help, then it could be infinite recursion.
October 8th 19 at 03:39
Thanks to all of you, go debit. Put xDebug
October 8th 19 at 03:41
If you use apache, we first see the output of top load, the second — place mod_status and check which queries are hanging. Then we can see why. Also, you can log the execution time of queries (Apache allows it)
October 8th 19 at 03:43
"Unknown on line 0" most likely indicates that the script is encoded by Zend\ioncube or similar. First look at the script (its name is displayed in the log, let the entry in the error_log).
There's no mention of Zenda/ioncube. And the error text I cited from the error_log. I rewrote a dubious place in the project and the problem disappeared. - Anthony.Considi commented on October 8th 19 at 03:46

Find more questions by tags Ruby on Rails