L
L
L0NGMAN2012-02-14 11:32:51
Ruby on Rails
L0NGMAN, 2012-02-14 11:32:51

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

The following entries appear in the logs: “PHP Fatal error: Maximum execution time of 30 seconds exceeded in Unknown on line 0” and the server freezes, does not enter via ssh / ftp, but responds to ping. Has anyone else experienced such miracles? Apache Server/2.2.3 (CentOS), PHP 5.3.10

Answer the question

In order to leave comments, you need to log in

7 answer(s)
I
Ivan Shalganov, 2012-02-14
@L0NGMAN

I can assume that your script falls into recursion, gets stuck, Apache starts enchantingly forking to satisfy requests, new processes also get stuck, the system is epochally losing resources (memory and CPU time), a lot is clogged in swap, other processes become incapacitated such like ssh, ftp due to lack of resources. Apache also gets up because fork stops working. After some time, the script is killed by Apache fork by max_execution_time, resources are returned, the sun is getting brighter, the sky is bluer, ssh is faster. Something like this. Total: a very heavy script was detected.

C
cat_crash, 2012-02-14
@cat_crash

I will supplement the previous post, respected Aco
Judging by the symptom, the system is really terribly short of resources.
- It is far from a fact that if it worked before, then there is no recursion. Error in logic + invalid data = infinite recursion.
What I can advise:
- Play around with memory_limit. It can help find the "weak link" recursion is usually fraught with eating up system resources
And of course, cruel porn debugging at night on a test environment. This is the only way you can understand the logic of someone else's code and find a bottleneck

S
step307, 2012-02-14
@step307

Look also at the access log, what preceded the fall, what requests. Maybe this will give you some idea.
It is also important to understand the frequency of the problem. This is due to the number of users (respectively, lack of resources) or with the entry of a search robot or with a rare but “accurate” call of some kind of heavy function (for cache re-sausage, importing a large amount of data, etc.)

V
Vitaly Zheltyakov, 2012-02-14
@VitaZheltyakov

Try set_time_limit(0);. If it doesn't help, then it could be an infinite recursion.

L
L0NGMAN, 2012-02-14
@L0NGMAN

Thank you all very much, I'll go debug. Install xDebug

E
egorinsk, 2012-02-14
@egorinsk

If you are using apache, then first of all look at the output of top under load, the second is to set mod_status and check which requests are hanging. Then you can see why. So, you can log the execution time of requests (apache allows this)

W
WebCraft, 2012-02-29
@WebCraft

"Unknown on line 0" most likely indicates that the script is encoded with zend/ioncube or similar. Look at the script itself first (its name is logged, enable writing to error_log).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question