Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'max_request_execution_time' not working when 'enable_coroutine' => false #136

Closed
sebastianwos opened this issue Jan 28, 2022 · 9 comments
Closed
Labels
question Further information is requested

Comments

@sebastianwos
Copy link

Is it possible to make 'max_request_execution_time' work for all HttpServer config, even when coroutine are disabled ?

@doubaokun doubaokun added feature request question Further information is requested and removed feature request labels Jan 28, 2022
@doubaokun
Copy link
Contributor

max_request_execution_time is supported in both coroutine and non-coroutine mode. But it may be delayed or blocked by syscall like sleep in non-coroutine mode when you are testing.

@smortexa
Copy link

smortexa commented Mar 2, 2022

@doubaokun The max_request_execution_time doesn't work in Laravel Octane (non-coroutine mode). It can be reproduced without sleep:

Route::get('/foo', function (Request $request) {
    for (;;){
    }
    return 'bar';
});

// config/octane.php

'swoole' => [
        'options' => [
            'max_request_execution_time' => 5,
        ]
    ]

@doubaokun
Copy link
Contributor

In real world applications, it should work. for (;;){ } is busy looping at CPU and there’s no chance for other code to be executed like termination.

@smortexa
Copy link

smortexa commented Mar 2, 2022

@doubaokun I tried this, but It still doesn't work:

Route::get('/foo', function (Request $request) {
    // 5s I/O operation
    \Illuminate\Support\Facades\Http::get('https://reqres.in/api/users?delay=5');
    return 'bar';
});

// config/octane.php

'swoole' => [
        'options' => [
            'max_request_execution_time' => 3,
        ]
    ]

@doubaokun
Copy link
Contributor

What version of OpenSwoole are you using (show your php --ri openswoole)?

@smortexa
Copy link

smortexa commented Mar 2, 2022

openswoole

Open Swoole => enabled
Author => Open Swoole Group <hello@openswoole.com>
Version => 4.10.0
Built => Mar  2 2022 19:28:03
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 1.1.1f  31 Mar 2020
dtls => enabled
http2 => enabled
curl-native => enabled
zlib => 1.2.11
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608

@doubaokun
Copy link
Contributor

Will have another check later.

@smortexa
Copy link

smortexa commented Oct 3, 2022

@doubaokun Any news on this?

@doubaokun
Copy link
Contributor

It is the expected behavior, if you don't enable coroutines in your application, the application may be blocked at syscalls such as CURL, sockets etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants