Closed sebastianwos closed 2 years ago
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.
@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,
]
]
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.
@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,
]
]
What version of OpenSwoole are you using (show your php --ri openswoole)?
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
Will have another check later.
@doubaokun Any news on this?
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.
Is it possible to make 'max_request_execution_time' work for all HttpServer config, even when coroutine are disabled ?