Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

max_execution_time reached too early #12814

Closed
@Muffinman

Description

@Muffinman

Description

Hi, I'm looking for some guidance in tracking down a very strange error withmax_execution_time setting not being honoured correctly.

We have an incoming JSON POST request to a Laravel backend, which does some processing and stores some data.

The request is a few KB of tree data, and the controller calls arebuildTree() method as below. Internally this makes a lot of calls to the MySQL DB and Redis DB.

Category::scoped(['site_key' =>config('cms_scope')])    ->rebuildTree($request->data);

The problem I'm facing is that this fails every time after1 second with this error:

Maximum execution time of 30 seconds exceeded

I have added some debugging to the exception handler to try to work out why it is doing this:

var_dump(time() -$_SERVER['REQUEST_TIME']);var_dump(getrusage());var_dump(ini_get('max_execution_time'));var_dump(error_get_last());
int(1) // Request had only been processing for ~1s before exception happenedarray(17) {  ["ru_oublock"]=>  int(0)  ["ru_inblock"]=>  int(0)  ["ru_msgsnd"]=>  int(43432)  ["ru_msgrcv"]=>  int(51349)  ["ru_maxrss"]=>  int(71073792)  ["ru_ixrss"]=>  int(0)  ["ru_idrss"]=>  int(0)  ["ru_minflt"]=>  int(17193)  ["ru_majflt"]=>  int(17)  ["ru_nsignals"]=>  int(15)  ["ru_nvcsw"]=>  int(7368)  ["ru_nivcsw"]=>  int(104279)  ["ru_nswap"]=>  int(0)  ["ru_utime.tv_usec"]=>  int(212295)  ["ru_utime.tv_sec"]=>  int(8)  ["ru_stime.tv_usec"]=>  int(564183)  ["ru_stime.tv_sec"]=>  int(1)}string(2) "30"array(4) {  ["type"]=>  int(1)  ["message"]=>  string(45) "Maximum execution time of 30 seconds exceeded"  ["file"]=>  string(112) "/path/to/site/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisConnection.php"  ["line"]=>  int(405)}

Now for the next strange part, if I set themax_execution_time to some other far larger value, it works!

// set_time_limit(30); // Didn't work, same error// set_time_limit(60); // Didn't work, same error// set_time_limit(120); // Didn't work, same errorset_time_limit(300);// Works. Request completed in around 3.5s!Category::scoped(['site_key' =>config('cms_scope')])    ->rebuildTree($request->data);

Screenshot 2023-11-28 at 13 41 38

PHP Version

PHP 8.2.13

Operating System

MacOS 14.1.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp