frankenphp icon indicating copy to clipboard operation
frankenphp copied to clipboard

crashed without any output and log

Open QThans opened this issue 8 months ago β€’ 13 comments

What happened?

openat(AT_FDCWD, "/www/wwwroot/paperhub/vendor/laravel/framework/src/Illuminate/Foundation/Events/Terminating.php", O_RDONLY) = 6 newfstatat(6, "", {st_mode=S_IFREG|0755, st_size=77, ...}, AT_EMPTY_PATH) = 0 read(6, "<?php\n\nnamespace Illuminate\Foun"..., 77) = 77 close(6) = 0 newfstatat(AT_FDCWD, "/www/wwwroot/paperhub/vendor/composer/../laravel/framework/src/Illuminate/View/Component.php", {st_mode=S_IFREG|0755, st_size=12866, ...}, AT_SYMLINK_NOFOLLOW) = 0 newfstatat(AT_FDCWD, "/www/wwwroot/paperhub/vendor/composer/../laravel/framework/src/Illuminate/View", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0 openat(AT_FDCWD, "/www/wwwroot/paperhub/vendor/laravel/framework/src/Illuminate/View/Component.php", O_RDONLY) = 6 newfstatat(6, "", {st_mode=S_IFREG|0755, st_size=12866, ...}, AT_EMPTY_PATH) = 0 read(6, "<?php\n\nnamespace Illuminate\View"..., 12866) = 12866 close(6) = 0 close(3) = 0 rt_sigaction(SIGINT, {sa_handler=0x559a763ca4ee, sa_mask=~[ILL TRAP ABRT BUS FPE KILL SEGV CONT STOP TSTP TTIN TTOU SYS RTMIN RT_1], sa_flags=SA_RESTORER|SA_INTERRUPT|SA_SIGINFO, sa_restorer=0x7f9f6c70e520}, NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [INT], NULL, 8) = 0 rt_sigaction(SIGTERM, {sa_handler=0x559a763ca4ee, sa_mask=~[ILL TRAP ABRT BUS FPE KILL SEGV CONT STOP TSTP TTIN TTOU SYS RTMIN RT_1], sa_flags=SA_RESTORER|SA_INTERRUPT|SA_SIGINFO, sa_restorer=0x7f9f6c70e520}, NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [TERM], NULL, 8) = 0 rt_sigaction(SIGHUP, {sa_handler=0x559a763ca4ee, sa_mask=~[ILL TRAP ABRT BUS FPE KILL SEGV CONT STOP TSTP TTIN TTOU SYS RTMIN RT_1], sa_flags=SA_RESTORER|SA_INTERRUPT|SA_SIGINFO, sa_restorer=0x7f9f6c70e520}, NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [HUP], NULL, 8) = 0 munmap(0x7f9f69047000, 65536) = 0 munmap(0x7f9f69ea0000, 65536) = 0 munmap(0x7f9f69eb0000, 65536) = 0 close(4) = 0 sendto(5, "X\0\0\0\4", 5, MSG_NOSIGNAL, NULL, 0) = 5 close(5) = 0 munmap(0x7f9f66a00000, 2621440) = 0 munmap(0x7f9f68400000, 2097152) = 0 munmap(0x7f9f68800000, 2097152) = 0 munmap(0x7f9f68a00000, 2097152) = 0 munmap(0x7f9f68200000, 2097152) = 0 munmap(0x7f9f67e00000, 2097152) = 0 munmap(0x7f9f68600000, 2097152) = 0 munmap(0x7f9f67400000, 2097152) = 0 munmap(0x7f9f67200000, 2097152) = 0 munmap(0x7f9f69057000, 196608) = 0 munmap(0x7f9f69444000, 58640) = 0 munmap(0x7f9f693f3000, 329312) = 0 munmap(0x7f9f6964e000, 116752) = 0 munmap(0x7f9f6953f000, 1106760) = 0 munmap(0x7f9f6952d000, 69648) = 0 munmap(0x7f9f6945b000, 184496) = 0 munmap(0x7f9f6966b000, 99224) = 0 munmap(0x7f9f69684000, 861256) = 0 munmap(0x7f9f69757000, 78768) = 0 munmap(0x7f9f6976b000, 7166680) = 0 munmap(0x7f9f69e72000, 149240) = 0 munmap(0x7f9f69e54000, 120400) = 0 munmap(0x7f9f69e41000, 76840) = 0 munmap(0x7f9f67600000, 2097152) = 0 munmap(0x7f9f67800000, 2097152) = 0 munmap(0x7f9f68000000, 2097152) = 0 munmap(0x7f9f67000000, 2097152) = 0 munmap(0x7f9f67c00000, 2097152) = 0 munmap(0x7f9f66e00000, 2097152) = 0 munmap(0x7f9f67a00000, 2097152) = 0 munmap(0x7f9f66800000, 2097152) = 0 munmap(0x7f9f6a200000, 2097152) = 0 munmap(0x7f9f68f65000, 659456) = 0 munmap(0x7f9f6a409000, 135168) = 0 exit_group(132) = ? +++ exited with 132 +++

Build Type

Standalone binary

Worker Mode

Yes

Operating System

GNU/Linux

CPU Architecture

x86_64

PHP configuration

\

Relevant log output


QThans avatar Apr 04 '25 06:04 QThans

I am also facing the same error on my Laravel app. The app works fine without FrankenPHP. On every request, it crashes and respawn a new worker over an over again.

Here are the logs:

2025-04-12 18:23:49,035 INFO spawned: 'php' with pid 99
2025-04-12 18:23:50,038 INFO success: php entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

   INFO  Server running….  


  Local: http://localhost:80 

  Press Ctrl+C to stop the server

   WARN  Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies.  

   WARN  server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server.  

   WARN  HTTP/2 skipped because it requires TLS.  

   WARN  HTTP/3 skipped because it requires TLS.  

   INFO  No scheduled commands are ready to run.  

2025-04-12 18:24:19,323 WARN exited: php (exit status 132; not expected)

I use the default sail docker setup of PHP 8.4 provided by Laravel.

Here is my docker compose:

services:
    laravel:
        build:
            context: './docker/8.4'
            dockerfile: Dockerfile
            args:
                WWWGROUP: '${WWWGROUP}'
        image: 'sail-8.4/app'
        extra_hosts:
            - 'host.docker.internal:host-gateway'
        environment:
            WWWUSER: '${WWWUSER}'
            LARAVEL_SAIL: 1
            IGNITION_LOCAL_SITES_PATH: '${PWD}'
            SUPERVISOR_PHP_COMMAND: "/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --host=localhost --port=80 --admin-port=2019 --workers=8"
            XDG_CONFIG_HOME: /var/www/html/config
            XDG_DATA_HOME: /var/www/html/data
        volumes:
            - '.:/var/www/html'

Dockerfile:

FROM ubuntu:24.04

LABEL maintainer="Taylor Otwell"

ARG WWWGROUP
ARG NODE_VERSION=22
ARG MYSQL_CLIENT="mysql-client"
ARG POSTGRES_VERSION=17

WORKDIR /var/www/html

ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80"
ENV SUPERVISOR_PHP_USER="sail"

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN echo "Acquire::http::Pipeline-Depth 0;" > /etc/apt/apt.conf.d/99custom && \
    echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf.d/99custom && \
    echo "Acquire::BrokenProxy    true;" >> /etc/apt/apt.conf.d/99custom

RUN apt-get update && apt-get upgrade -y \
    && mkdir -p /etc/apt/keyrings \
    && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python3 dnsutils librsvg2-bin fswatch ffmpeg nano  \
    && curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
    && echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
    && apt-get update \
    && apt-get install -y php8.4-cli php8.4-dev \
       php8.4-pgsql php8.4-sqlite3 php8.4-gd \
       php8.4-curl php8.4-mongodb \
       php8.4-imap php8.4-mysql php8.4-mbstring \
       php8.4-xml php8.4-zip php8.4-bcmath php8.4-soap \
       php8.4-intl php8.4-readline \
       php8.4-ldap \
       php8.4-msgpack php8.4-igbinary php8.4-redis \
#       php8.4-swoole \
       php8.4-memcached php8.4-pcov php8.4-imagick php8.4-xdebug \
    && curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
    && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
    && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
    && apt-get update \
    && apt-get install -y nodejs \
    && npm install -g npm \
    && npm install -g pnpm \
    && npm install -g bun \
    && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null \
    && echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
    && curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg >/dev/null \
    && echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt noble-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
    && apt-get update \
    && apt-get install -y yarn \
    && apt-get install -y $MYSQL_CLIENT \
    && apt-get install -y postgresql-client-$POSTGRES_VERSION \
    && apt-get -y autoremove \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.4

RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail

COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.4/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container

EXPOSE 80/tcp

ENTRYPOINT ["start-container"]

Supervisor config:

[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid

[program:php]
command=%(ENV_SUPERVISOR_PHP_COMMAND)s
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

mahiarirani avatar Apr 13 '25 08:04 mahiarirani

I have reverted my setup back to PHP 8.3 with everything exactly as above, and it's now working fine. I rechecked with PHP 8.4 again and can confirm the FrankenPHP binary it fetches for PHP 8.4 will cause this.

mahiarirani avatar Apr 17 '25 05:04 mahiarirani

The only difference I found between my 8.3 vs 8.4 Dockerfile was php8.4-swoole extension not being installed. I see this was later fixed on the latest version of sail https://github.com/laravel/sail/commit/f649351c1c18f3c74159de97f7c1ee7a4d5769e4.

With that added, my app is back working fine on PHP 8.4 as well. How could that extension make a difference in FrankenPHP?

I've noticed when that extension was not enabled, a different binary was being download compared to now.

With php8.4-swoole installed: 60616827/65875820 [β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–‘β–‘β–‘] 92%

Without php8.4-swoole installed: 54196946/66029280 [β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘] 82%

mahiarirani avatar Apr 17 '25 05:04 mahiarirani

@QThans @mahiarirani how are you running the laravel application with frankenphp? can you share the Dockerfile, etc?

sneycampos avatar Apr 17 '25 09:04 sneycampos

@QThans @mahiarirani how are you running the laravel application with frankenphp? can you share the Dockerfile, etc?

I have shared them all in the first comment. It's basic laravel sail setup with octane.

mahiarirani avatar Apr 17 '25 09:04 mahiarirani

@QThans @mahiarirani how are you running the laravel application with frankenphp? can you share the Dockerfile, etc?

I have shared them all in the first comment. It's basic laravel sail setup with octane.

Ok but i don't see any frankenphp related in this Dockerfile πŸ‘€ I'll try to reproduce using sail

sneycampos avatar Apr 17 '25 09:04 sneycampos

@QThans @mahiarirani how are you running the laravel application with frankenphp? can you share the Dockerfile, etc?

I have shared them all in the first comment. It's basic laravel sail setup with octane.

Ok but i don't see any frankenphp related in this Dockerfile πŸ‘€

This command runs the app on frankenphp

/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --host=localhost --port=80 --admin-port=2019 --workers=8

https://frankenphp.dev/docs/laravel/

https://laravel.com/docs/12.x/octane#frankenphp

mahiarirani avatar Apr 17 '25 09:04 mahiarirani

This command runs the app on frankenphp

/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --host=localhost --port=80 --admin-port=2019 --workers=8

  • created a fresh laravel application with composer create-project
  • installed sail
  • updated the supervisord.conf with octane's:
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --host=localhost --port=80 --admin-port=2019 --workers=8
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
  • Added the environment variables to docker-compose.yml in laravel.test service:
XDG_CONFIG_HOME: /var/www/html/config
XDG_DATA_HOME: /var/www/html/data
  • Ran ./vendor/bin/sail up and application started up

Image

I did run a benchmark test with wrk and worked 100%

Can you tell me how to reproduce the error? (I'm using an Apple Silicon processor)

You can check the repository here

sneycampos avatar Apr 17 '25 09:04 sneycampos

This command runs the app on frankenphp

/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --host=localhost --port=80 --admin-port=2019 --workers=8

  • created a fresh laravel application with composer create-project
  • installed sail
  • updated the supervisord.conf with octane's:
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --host=localhost --port=80 --admin-port=2019 --workers=8
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
  • Added the environment variables to docker-compose.yml in laravel.test service:
XDG_CONFIG_HOME: /var/www/html/config
XDG_DATA_HOME: /var/www/html/data
  • Ran ./vendor/bin/sail up and application started up

Image

I did run a benchmark test with wrk and worked 100%

Can you tell me how to reproduce the error? (I'm using an Apple Silicon processor)

You can check the repository here

I had the sail dockerfiles published at version 1.40 which had the php8.4-swoole extension installation commented out. I believe that caused the issue.

I faced the same issue both on my local machine which is Apple Silicon and also on my server which is X86 Ubuntu.

mahiarirani avatar Apr 17 '25 09:04 mahiarirani

I had the sail dockerfiles published at version 1.40 which had the php8.4-swoole extension installation commented out. I believe that caused the issue.

I faced the same issue both on my local machine which is Apple Silicon and also on my server which is X86 Ubuntu.

Updated the Dockerfile removing the swoole extension and built with ./vendor/bin/sail build --no-cache. Could you try with this repository code?

sneycampos avatar Apr 17 '25 10:04 sneycampos

I had the sail dockerfiles published at version 1.40 which had the php8.4-swoole extension installation commented out. I believe that caused the issue.

I faced the same issue both on my local machine which is Apple Silicon and also on my server which is X86 Ubuntu.

Updated the Dockerfile removing the swoole extension and built with ./vendor/bin/sail build --no-cache. Could you try with this repository code?

Sure. I will try in a few minutes. Also I believe you need to remove the frankenphp binary downloaded in the root and let it get a fresh one with the new build to reproduce the issue.

mahiarirani avatar Apr 17 '25 10:04 mahiarirani

I had the sail dockerfiles published at version 1.40 which had the php8.4-swoole extension installation commented out. I believe that caused the issue. I faced the same issue both on my local machine which is Apple Silicon and also on my server which is X86 Ubuntu.

Updated the Dockerfile removing the swoole extension and built with ./vendor/bin/sail build --no-cache. Could you try with this repository code?

Sure. I will try in a few minutes. Also I believe you need to remove the frankenphp binary downloaded in the root and let it get a fresh one with the new build to reproduce the issue.

I used this repo and run the container, but I couldn't reproduce the issue. I see it's fetching the frankenphp binary which is working for me as well

Image

This binary which has the size of 65875820 works fine. The issues were faced when the frankenphp binary which had the size of 66029280 has been used.

mahiarirani avatar Apr 17 '25 10:04 mahiarirani

host.docker.internal does not exists on linux

And you don't need to do apt-get install php, everything is integrated into Frankenphp.

And the frankenphp docker image contains a special command (install-php-extensions) to install php extensions. This command should be used first.

abda11ah avatar May 08 '25 04:05 abda11ah