What happened?
Hey, we use FrankenPHP on all envs with Laravel. Some time ago we've switched from using php to frankenphp php-cli for stuff like Scheduler and Horizon. We also added this to AppServiceProvider boot method:
SupervisorCommandString::$command = 'exec /usr/local/bin/frankenphp php-cli artisan horizon:supervisor';
WorkerCommandString::$command = 'exec /usr/local/bin/frankenphp php-cli artisan horizon:work';
^^ It's to ensure sub-processes will also use frankenphp php-cli.
At the beginning everything was fine, but last time our developers started to report issues with queues / strange behavior.
For example chained jobs, really small and simple: main job pushed 20 chained jobs and only first 3-4 were processed, then next one stuck in pending state and the whole chain failed after exceeding retry_after from queues config
There are a lot of factors like horizon/queues config, machines config etc but everything works fine after switching back to php artisan horizon and removing mentioned part from AppServiceProvider
Right now we are not sure - is it fine to use frankenphp php-cli for long-running jobs like scheduler/horizon or other? It has some nice advantages like reacting properly on system signals (used especially on Kubernetes and lara scheduler). If possible, we do not want to use supervisor
We've checked other parts like databases/possible deadlock issues etc. and can exclude them
Build Type
Docker (Debian Trixie)
Worker Mode
Yes
Operating System
GNU/Linux
CPU Architecture
x86_64
PHP configuration
Frankenphp 1.9.1 based on Debian Trixie with PHP 8.4
Installed extensions:
RUN install-php-extensions \
bcmath \
exif \
gd \
gettext \
igbinary \
imagick \
intl \
mongodb \
opcache \
pcntl \
pgsql \
pdo_pgsql \
redis \
xsl \
yaml \
zip \
zstd \
@composer
On Kubernetes we use non-root, read-only filesystem (securityContext) without any privileges but it does not matter - problem exists even on local
php.ini config for instances with running Horizon / Schduler
max_execution_time = 0
max_input_time = 0
max_input_vars = 25000
memory_limit = 1024M
post_max_size = 2048M
upload_tmp_dir = /tmp
upload_max_filesize = 2048M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 256
opcache.interned_strings_buffer = 32
opcache.max_accelerated_files = 50000
opcache.validate_timestamps = 0
opcache.file_cache = /tmp/php-opcache
opcache.jit = tracing
opcache.jit_buffer_size = 256M
Relevant log output
No logs, we just see jobs randomly stuck - because of that queues are slower
What happened?
Hey, we use FrankenPHP on all envs with Laravel. Some time ago we've switched from using
phptofrankenphp php-clifor stuff like Scheduler and Horizon. We also added this to AppServiceProvider boot method:^^ It's to ensure sub-processes will also use frankenphp php-cli.
At the beginning everything was fine, but last time our developers started to report issues with queues / strange behavior.
For example chained jobs, really small and simple: main job pushed 20 chained jobs and only first 3-4 were processed, then next one stuck in pending state and the whole chain failed after exceeding
retry_afterfrom queues configThere are a lot of factors like horizon/queues config, machines config etc but everything works fine after switching back to
php artisan horizonand removing mentioned part from AppServiceProviderRight now we are not sure - is it fine to use
frankenphp php-clifor long-running jobs like scheduler/horizon or other? It has some nice advantages like reacting properly on system signals (used especially on Kubernetes and lara scheduler). If possible, we do not want to use supervisorWe've checked other parts like databases/possible deadlock issues etc. and can exclude them
Build Type
Docker (Debian Trixie)
Worker Mode
Yes
Operating System
GNU/Linux
CPU Architecture
x86_64
PHP configuration
Frankenphp 1.9.1 based on Debian Trixie with PHP 8.4 Installed extensions: RUN install-php-extensions \ bcmath \ exif \ gd \ gettext \ igbinary \ imagick \ intl \ mongodb \ opcache \ pcntl \ pgsql \ pdo_pgsql \ redis \ xsl \ yaml \ zip \ zstd \ @composerOn Kubernetes we use non-root, read-only filesystem (securityContext) without any privileges but it does not matter - problem exists even on local
php.ini config for instances with running Horizon / Schduler
Relevant log output
No logs, we just see jobs randomly stuck - because of that queues are slower