dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.7k stars 220 forks source link

Octane & FrankenPHP silent crash #543

Closed mstaack closed 4 months ago

mstaack commented 7 months ago

What happened?

just dies without any real log, nginx returns 502

strace output seems like a memory/segfault thing

php -v
PHP 8.3.2-1+ubuntu22.04.1+deb.sury.org+1 (cli) (built: Jan 20 2024 14:16:40) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.2-1+ubuntu22.04.1+deb.sury.org+1, Copyright (c), by Zend Technologies

debug output:

{"level":"warn","ts":1706861263.2252586,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/home/forge/.local/share/caddy","instance":"5bb06ca7-8d5d-4069-88b4-ca8059193d98","try_again":1706947663.2252555,"try_again_in":86399.999998918}
{"level":"info","ts":1706861263.2253764,"logger":"tls","msg":"finished cleaning storage units"}
{"level":"info","ts":1706861263.3534791,"msg":"FrankenPHP started 🐘","php_version":"8.3.2"}
{"level":"info","ts":1706861263.3536866,"msg":"autosaved config (load with --resume flag)","file":"/home/forge/.config/caddy/autosave.json"}
{"level":"info","ts":1706861263.353692,"msg":"serving initial configuration"}

Build Type

Standalone binary

Worker Mode

No

Operating System

GNU/Linux

CPU Architecture

x86_64

Relevant log output

newfstatat(5, "", {st_mode=S_IFREG|0664, st_size=12183, ...}, AT_EMPTY_PATH) = 0
read(5, "<?php\n\nnamespace Illuminate\\View"..., 12183) = 12183
close(5)                                = 0
close(3)                                = 0
getrandom("\x5c\x39\x4d\x65\xdb\x71\x1f\x50\x15\xc7\xa7\x0f\x4b\x0d\xa1\xa1", 16, 0) = 16
rt_sigaction(SIGINT, {sa_handler=0x559475ddadf0, sa_mask=~[ILL TRAP ABRT BUS FPE KILL SEGV CONT STOP TSTP TTIN TTOU SYS RTMIN RT_1], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT|SA_SIGINFO, sa_restorer=0x7ff3182db520}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [INT], NULL, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x559475ddadf0, sa_mask=~[ILL TRAP ABRT BUS FPE KILL SEGV CONT STOP TSTP TTIN TTOU SYS RTMIN RT_1], sa_flags=SA_RESTORER|SA_ONSTACK|SA_INTERRUPT|SA_SIGINFO, sa_restorer=0x7ff3182db520}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [TERM], NULL, 8) = 0
munmap(0x7ff31287d000, 65536)           = 0
close(4)                                = 0
munmap(0x7ff30f200000, 2621440)         = 0
munmap(0x7ff311000000, 2097152)         = 0
munmap(0x7ff311600000, 2097152)         = 0
munmap(0x7ff311400000, 2097152)         = 0
munmap(0x7ff310800000, 2097152)         = 0
munmap(0x7ff311200000, 2097152)         = 0
munmap(0x7ff310000000, 2097152)         = 0
munmap(0x7ff310400000, 2097152)         = 0
munmap(0x7ff310e00000, 2097152)         = 0
munmap(0x7ff30f800000, 2097152)         = 0
munmap(0x7ff30fa00000, 2097152)         = 0
munmap(0x7ff311aef000, 107024)          = 0
munmap(0x7ff311ad1000, 120400)          = 0
munmap(0x7ff311abe000, 76840)           = 0
munmap(0x7ff311cd5000, 41448)           = 0
munmap(0x7ff311c6e000, 98328)           = 0
munmap(0x7ff311c87000, 267648)          = 0
munmap(0x7ff311b30000, 1299576)         = 0
munmap(0x7ff311b0a000, 151992)          = 0
munmap(0x7ff311ce0000, 53712)           = 0
munmap(0x7ff311cee000, 50024)           = 0
munmap(0x7ff311cfb000, 37080)           = 0
munmap(0x7ff311d05000, 25064)           = 0
munmap(0x7ff311ee0000, 16872)           = 0
munmap(0x7ff311ee5000, 25064)           = 0
munmap(0x7ff311d0c000, 78792)           = 0
munmap(0x7ff311d20000, 111488)          = 0
munmap(0x7ff311d3c000, 345136)          = 0
munmap(0x7ff311d91000, 66024)           = 0
munmap(0x7ff315b0e000, 20968)           = 0
munmap(0x7ff311da2000, 857128)          = 0
munmap(0x7ff311eec000, 41280)           = 0
munmap(0x7ff311ea6000, 233536)          = 0
munmap(0x7ff311e74000, 203040)          = 0
munmap(0x7ff3120b1000, 45264)           = 0
munmap(0x7ff311ef7000, 292000)          = 0
munmap(0x7ff311f3f000, 148648)          = 0
munmap(0x7ff312115000, 41168)           = 0
munmap(0x7ff311f64000, 1362360)         = 0
munmap(0x7ff312120000, 53456)           = 0
munmap(0x7ff3120bd000, 352640)          = 0
munmap(0x7ff31283f000, 37080)           = 0
munmap(0x7ff31212e000, 170136)          = 0
munmap(0x7ff315020000, 98616)           = 0
munmap(0x7ff312653000, 601488)          = 0
munmap(0x7ff312642000, 65768)           = 0
munmap(0x7ff312313000, 3334864)         = 0
munmap(0x7ff312849000, 115376)          = 0
munmap(0x7ff31272e000, 1106760)         = 0
munmap(0x7ff31271c000, 69648)           = 0
munmap(0x7ff3126ee000, 184496)          = 0
munmap(0x7ff312866000, 53496)           = 0
munmap(0x7ff31289d000, 74256)           = 0
munmap(0x7ff315b14000, 20688)           = 0
munmap(0x7ff3128b0000, 258048)          = 0
munmap(0x7ff314807000, 115400)          = 0
munmap(0x7ff31479d000, 432504)          = 0
munmap(0x7ff314718000, 300640)          = 0
munmap(0x7ff314650000, 815120)          = 0
munmap(0x7ff314762000, 237584)          = 0
munmap(0x7ff3145ba000, 82800)           = 0
munmap(0x7ff314533000, 549360)          = 0
munmap(0x7ff3144c6000, 443496)          = 0
munmap(0x7ff314420000, 139472)          = 0
munmap(0x7ff3143ef000, 196792)          = 0
munmap(0x7ff3143e6000, 32808)           = 0
munmap(0x7ff3142a6000, 1310000)         = 0
munmap(0x7ff314295000, 68488)           = 0
munmap(0x7ff314271000, 143416)          = 0
munmap(0x7ff312a92000, 892208)          = 0
munmap(0x7ff314443000, 534712)          = 0
munmap(0x7ff312b6c000, 1595136)         = 0
munmap(0x7ff312cf2000, 16140448)        = 0
munmap(0x7ff313c57000, 693448)          = 0
munmap(0x7ff313d01000, 5697824)         = 0
munmap(0x7ff312a10000, 528416)          = 0
munmap(0x7ff3145cf000, 524976)          = 0
munmap(0x7ff3129e6000, 168584)          = 0
munmap(0x7ff3129e1000, 16424)           = 0
munmap(0x7ff3129d4000, 51136)           = 0
munmap(0x7ff3129c2000, 70088)           = 0
munmap(0x7ff3129bc000, 20744)           = 0
munmap(0x7ff3129b4000, 28800)           = 0
munmap(0x7ff3129ac000, 28720)           = 0
munmap(0x7ff3129a7000, 16416)           = 0
munmap(0x7ff31299e000, 33408)           = 0
munmap(0x7ff31298b000, 74000)           = 0
munmap(0x7ff31295c000, 94432)           = 0
munmap(0x7ff312955000, 24632)           = 0
munmap(0x7ff31294a000, 40992)           = 0
munmap(0x7ff31292b000, 122920)          = 0
munmap(0x7ff312911000, 102576)          = 0
munmap(0x7ff312909000, 28704)           = 0
munmap(0x7ff3128fc000, 49384)           = 0
munmap(0x7ff3128f6000, 20504)           = 0
munmap(0x7ff3128ef000, 24608)           = 0
munmap(0x7ff314824000, 78288)           = 0
munmap(0x7ff314838000, 8099072)         = 0
munmap(0x7ff314ff2000, 186576)          = 0
munmap(0x7ff3121eb000, 1211776)         = 0
munmap(0x7ff312158000, 600208)          = 0
munmap(0x7ff315039000, 219640)          = 0
munmap(0x7ff315b1a000, 127960)          = 0
munmap(0x7ff315a67000, 680808)          = 0
munmap(0x7ff315a3d000, 168208)          = 0
munmap(0x7ff3159fd000, 123824)          = 0
munmap(0x7ff315990000, 443872)          = 0
munmap(0x7ff31597c000, 77840)           = 0
munmap(0x7ff315928000, 340960)          = 0
munmap(0x7ff3158c9000, 387936)          = 0
munmap(0x7ff3158b8000, 65960)           = 0
munmap(0x7ff3157e9000, 843832)          = 0
munmap(0x7ff3157db000, 53352)           = 0
munmap(0x7ff315446000, 2009088)         = 0
munmap(0x7ff315a1c000, 131088)          = 0
munmap(0x7ff315631000, 1743080)         = 0
munmap(0x7ff3153fe000, 291640)          = 0
munmap(0x7ff3153b8000, 282840)          = 0
munmap(0x7ff315336000, 528912)          = 0
munmap(0x7ff31526b000, 830576)          = 0
munmap(0x7ff31523c000, 188472)          = 0
munmap(0x7ff315236000, 20552)           = 0
munmap(0x7ff315228000, 54224)           = 0
munmap(0x7ff31520d000, 107504)          = 0
munmap(0x7ff3151ea000, 139320)          = 0
munmap(0x7ff3150af000, 1289160)         = 0
munmap(0x7ff315097000, 94760)           = 0
munmap(0x7ff315090000, 24592)           = 0
munmap(0x7ff31507c000, 80456)           = 0
munmap(0x7ff31506f000, 50736)           = 0
munmap(0x7ff318d8f000, 16592)           = 0
munmap(0x7ff315b3a000, 41168)           = 0
munmap(0x7ff315b45000, 45344)           = 0
munmap(0x7ff315b51000, 61968)           = 0
munmap(0x7ff315b61000, 132152)          = 0
munmap(0x7ff315b82000, 237664)          = 0
munmap(0x7ff311a8e000, 196608)          = 0
munmap(0x7ff315bbd000, 1060416)         = 0
munmap(0x7ff30fc00000, 2097152)         = 0
munmap(0x7ff310a00000, 2097152)         = 0
munmap(0x7ff310200000, 2097152)         = 0
munmap(0x7ff30f600000, 2097152)         = 0
munmap(0x7ff310c00000, 2097152)         = 0
munmap(0x7ff310600000, 2097152)         = 0
munmap(0x7ff30f000000, 2097152)         = 0
munmap(0x7ff30fe00000, 2097152)         = 0
munmap(0x7ff30ee00000, 2097152)         = 0
munmap(0x7ff316000000, 2097152)         = 0
munmap(0x7ff31199c000, 659456)          = 0
exit_group(139)                         = ?
+++ exited with 139 +++
dunglas commented 7 months ago

Does it crash at startup?

dunglas commented 7 months ago

PHP 8.3.2-1+ubuntu22.04.1+deb.sury.org+1 (cli) (built: Jan 20 2024 14:16:40) (NTS)

You cannot use an NTS build. FrankenPHP needs a ZTS build.

dunglas commented 7 months ago

Actually, if it's just the runner, this should work.

Are you using the official builds of FrankenPHP?

mstaack commented 7 months ago

just using a default forge php8.3 provisioned server with octane installation:

php artisan octane:install

 Which application server you would like to use?:
  [0] roadrunner
  [1] swoole
  [2] frankenphp
 > 2

 FrankenPHP's Octane integration is in beta and should be used with caution in production. Do you wish to continue? (yes/no) [no]:
 > yes

INFO  Octane installed successfully

after that i have:

./frankenphp -v
FrankenPHP v1.0.3 PHP 8.3.2 Caddy v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A=

update: ./artisan octane:start works and using curl locally with the server also:

curl http://127.0.0.1:8000
{"message":"Welcome to our world."}

so its maybe some nginx/forge setup weirdness...not directly related to frankenphp crashing..

Orrison commented 7 months ago

I get this same issue. Both when running through nginx and when just running frankenphp via Octane normally on port 80

fjbotti commented 4 months ago

Hi guys,

I have the same problem here using Frankenphp from Octane with Laravel Forge. Let me share the output of the strace:

`getsockname(23, {sa_family=AF_INET6, sin6_port=htons(8000), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "::ffff:127.0.0.1", &sin6_addr), sin6_scope_id=0}, [112 => 28]) = 0 setsockopt(23, SOL_TCP, TCP_NODELAY, [1], 4) = 0 setsockopt(23, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0 setsockopt(23, SOL_TCP, TCP_KEEPINTVL, [15], 4) = 0 setsockopt(23, SOL_TCP, TCP_KEEPIDLE, [15], 4) = 0 futex(0xc00049b148, FUTEX_WAKE_PRIVATE, 1) = 1 accept4(16, 0xc00065fba4, [112], SOCK_CLOEXEC|SOCK_NONBLOCK) = -1 EAGAIN (Resource temporarily unavailable) futex(0x7f866c686ea0, FUTEX_WAIT_PRIVATE, 0, NULL

) = 0 futex(0x7f866c686ea0, FUTEX_WAIT_PRIVATE, 0, NULL) = 0 futex(0x7f866c686ea0, FUTEX_WAIT_PRIVATE, 0, NULL) = 0 futex(0x7f866c686ea0, FUTEX_WAIT_PRIVATE, 0, NULL) = 0 futex(0x7f866c686ea0, FUTEX_WAIT_PRIVATE, 0, NULL) = -1 EAGAIN (Resource temporarily unavailable) futex(0x7f866c686ea0, FUTEX_WAIT_PRIVATE, 0, NULL) = 0 futex(0x7f866c686ea0, FUTEX_WAIT_PRIVATE, 0, NULL) = 0 futex(0x7f866c686ea0, FUTEX_WAIT_PRIVATE, 0, NULL) = ? +++ killed by SIGSEGV (core dumped) +++ `

Environment: Laravel: 10.48.10 Octane: 2.3.10 FrankenPHP v1.1.4 PHP 8.3.6 Caddy v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A=

dunglas commented 4 months ago

Hi @fjbotti,

Could you please try to gather a stack trace by running these steps? https://frankenphp.dev/docs/contributing/#debugging-segmentation-faults-with-static-builds

Thank you!

mstaack commented 4 months ago

latest release worked for me, so closing this one πŸ‘ŒπŸΌ