Skip to content

Franken crash #646

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

Closed
XTalandier opened this issue Jul 3, 2024 · 7 comments
Closed

Franken crash #646

XTalandier opened this issue Jul 3, 2024 · 7 comments

Comments

@XTalandier
Copy link

Hello,

I'm not sure if this is the right place to report this issue.

We have an automated build that runs every night. This morning, the builds and deployments completed successfully, but our app is crashing. There have been no code changes, just a simple build & deploy.

When I connect to the container, everything works correctly and I can execute PHP commands.

However, when we call our API, the server crashes completely https://pastebin.com/WNfQyTGY.

mystemi_dev-1  | runtime: newstack at runtime.printlock+0x55 sp=0xc0000a0c38 stack=[0xc0000a0000, 0xc0000a1000]
mystemi_dev-1  | 	morebuf={pc:0x40cdb4 sp:0xc0000a0c40 lr:0x0}
mystemi_dev-1  | 	sched={pc:0x4453d5 sp:0xc0000a0c38 lr:0x0 ctxt:0x0}
mystemi_dev-1  | runtime.callbackUpdateSystemStack(0xc000101808, 0x7fd52a9fcb10, 0x0)
mystemi_dev-1  | 	/usr/local/go/src/runtime/cgocall.go:241 +0x94 fp=0xc0000a0ca0 sp=0xc0000a0c40 pc=0x40cdb4
mystemi_dev-1  | runtime.cgocallbackg(0x16a2560, 0x7fd52a9fcb90, 0x0)
mystemi_dev-1  | 	/usr/local/go/src/runtime/cgocall.go:306 +0x7d fp=0xc0000a0d18 sp=0xc0000a0ca0 pc=0x40cfdd
mystemi_dev-1  | runtime.cgocallbackg(0x16a2560, 0x7fd52a9fcb90, 0x0)
mystemi_dev-1  | 	<autogenerated>:1 +0x29 fp=0xc0000a0d40 sp=0xc0000a0d18 pc=0x4811a9
mystemi_dev-1  | runtime.cgocallback(0xc0000a0da0, 0x40ccb5, 0x183c630)
mystemi_dev-1  | 	/usr/local/go/src/runtime/asm_amd64.s:1079 +0xcc fp=0xc0000a0d68 sp=0xc0000a0d40 pc=0x47e7ec
mystemi_dev-1  | runtime.systemstack_switch()
mystemi_dev-1  | 	/usr/local/go/src/runtime/asm_amd64.s:474 +0x8 fp=0xc0000a0d78 sp=0xc0000a0d68 pc=0x47ca28
mystemi_dev-1  | runtime.cgocall(0x183c630, 0xc0000a0dd8)
mystemi_dev-1  | 	/usr/local/go/src/runtime/cgocall.go:175 +0x75 fp=0xc0000a0db0 sp=0xc0000a0d78 pc=0x40ccb5
mystemi_dev-1  | github.com/dunglas/frankenphp._Cfunc_frankenphp_execute_script(0x7fd52a4605b0)
mystemi_dev-1  | 	_cgo_gotypes.go:791 +0x47 fp=0xc0000a0dd8 sp=0xc0000a0db0 pc=0x1699dc7
mystemi_dev-1  | github.com/dunglas/frankenphp.go_execute_script(0x47ca01?)
mystemi_dev-1  | 	/go/src/app/frankenphp.go:511 +0x133 fp=0xc0000a0e40 sp=0xc0000a0dd8 pc=0x169ceb3
mystemi_dev-1  | _cgoexp_a0107ffcccc7_go_execute_script(0x1f773e8?)
mystemi_dev-1  | 	_cgo_gotypes.go:923 +0x16 fp=0xc0000a0e58 sp=0xc0000a0e40 pc=0x16a23d6
mystemi_dev-1  | runtime.cgocallbackg1(0x16a23c0, 0x7fd52a9ff5a0, 0x0)
mystemi_dev-1  | 	/usr/local/go/src/runtime/cgocall.go:420 +0x2a5 fp=0xc0000a0f18 sp=0xc0000a0e58 pc=0x40d3e5
mystemi_dev-1  | runtime.cgocallbackg(0x16a23c0, 0x7fd52a9ff5a0, 0x0)
mystemi_dev-1  | 	/usr/local/go/src/runtime/cgocall.go:339 +0x136 fp=0xc0000a0f90 sp=0xc0000a0f18 pc=0x40d096
mystemi_dev-1  | runtime.cgocallbackg(0x16a23c0, 0x7fd52a9ff5a0, 0x0)
mystemi_dev-1  | 	<autogenerated>:1 +0x29 fp=0xc0000a0fb8 sp=0xc0000a0f90 pc=0x4811a9
mystemi_dev-1  | runtime.cgocallback(0x0, 0x0, 0x0)
mystemi_dev-1  | 	/usr/local/go/src/runtime/asm_amd64.s:1079 +0xcc fp=0xc0000a0fe0 sp=0xc0000a0fb8 pc=0x47e7ec
mystemi_dev-1  | runtime.goexit({})
mystemi_dev-1  | 	/usr/local/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0000a0fe8 sp=0xc0000a0fe0 pc=0x47ea41
mystemi_dev-1  | fatal error: runtime: stack split at bad time
mystemi_dev-1  | 

It seems that the frankenphp Docker image was updated this morning.

Help...

@dunglas
Copy link
Owner

dunglas commented Jul 3, 2024

Can you copy your Dockerfile please?

@XTalandier
Copy link
Author

Yes !

#syntax=docker/dockerfile:1.4

# Versions
FROM dunglas/frankenphp:1-alpine AS frankenphp_upstream

# The different stages of this Dockerfile are meant to be built into separate images
# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage
# https://docs.docker.com/compose/compose-file/#target


# Base FrankenPHP image
FROM frankenphp_upstream AS frankenphp_base

WORKDIR /app

# persistent / runtime deps
# hadolint ignore=DL3018
RUN apk add --no-cache \
		acl \
		file \
		gettext \
		git \
	    gmp-dev \
    	libmcrypt-dev \
	    libpng-dev \
	;

RUN docker-php-ext-install pdo pdo_mysql gmp bcmath gd

RUN set -eux; \
	install-php-extensions \
		@composer \
		apcu \
		intl \
		opcache \
		zip \
		pdo \
    	pdo_mysql \
	;

# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER=1

###> recipes ###
###< recipes ###

COPY --link frankenphp/conf.d/app.ini $PHP_INI_DIR/conf.d/
COPY --link --chmod=755 frankenphp/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
COPY --link frankenphp/Caddyfile /etc/caddy/Caddyfile

ENTRYPOINT ["docker-entrypoint"]

HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ]

# Dev FrankenPHP image
FROM frankenphp_base AS frankenphp_dev

ENV APP_ENV=dev XDEBUG_MODE=off
VOLUME /app/var/

RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"

RUN set -eux; \
	install-php-extensions \
		xdebug \
	;

COPY --link frankenphp/conf.d/app.dev.ini $PHP_INI_DIR/conf.d/

CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile", "--watch" ]

# Prod FrankenPHP image
FROM frankenphp_base AS frankenphp_prod

ENV APP_ENV=prod
#ENV FRANKENPHP_CONFIG="import worker.Caddyfile"

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

COPY --link frankenphp/conf.d/app.prod.ini $PHP_INI_DIR/conf.d/
#COPY --link frankenphp/worker.Caddyfile /etc/caddy/worker.Caddyfile

# prevent the reinstallation of vendors at every changes in the source code
COPY --link composer.* symfony.* ./
RUN set -eux; \
	composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress

# copy sources
COPY --link . ./
RUN rm -Rf frankenphp/

RUN set -eux; \
	mkdir -p var/cache var/log; \
	composer dump-autoload --classmap-authoritative --no-dev; \
	composer dump-env prod; \
	composer run-script --no-dev post-install-cmd; \
	chmod +x bin/console; sync;

@dunglas
Copy link
Owner

dunglas commented Jul 3, 2024

Ok, we had the same issue on an internal project. This looks to affect only Alpine builds. Could you try to switch to Debian, please?
Alpine isn't supported officially by Symfony Docker anymore (but a fix would be appreciated if someone finds the underlying issue).

@XTalandier
Copy link
Author

With this ?

FROM dunglas/frankenphp:1-php8.3 AS frankenphp_upstream

@dunglas
Copy link
Owner

dunglas commented Jul 3, 2024

Yes, and you also need to replace the RUN instruction using apk by this: https://github.com/dunglas/symfony-docker/blob/main/Dockerfile#L20-L25

@XTalandier
Copy link
Author

ok it looks like all is good with that. Thank you !

@dunglas
Copy link
Owner

dunglas commented Jul 3, 2024

See also golang/go#68285

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

No branches or pull requests

2 participants