frankenphp icon indicating copy to clipboard operation
frankenphp copied to clipboard

Segfault when using FrankenPHP with Laravel

Open Muvikx opened this issue 1 year ago • 5 comments

What happened?

Segfault when spamming same page.

I use use FrankenPHP with octane insine a Docker

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

php -v Zend Engine v4.3.2, Copyright (c) Zend Technologies

Starting server with php artisan octane:start --server=frankenphp --host=0.0.0.0 --port=8000

Build Type

Official static build

Worker Mode

Yes

Operating System

GNU/Linux

CPU Architecture

x86_64

Relevant log output

app-1    | newfstatat(AT_FDCWD, "/var/www/html/vendor/composer/../laravel/framework/src/Illuminate/Support/Lottery.php", {st_mode=S_IFREG|0644, st_size=5791, ...}, AT_SYMLINK_NOFOLLOW) = 0
app-1    | openat(AT_FDCWD, "/var/www/html/vendor/laravel/framework/src/Illuminate/Support/Lottery.php", O_RDONLY) = 6
app-1    | newfstatat(6, "", {st_mode=S_IFREG|0644, st_size=5791, ...}, AT_EMPTY_PATH) = 0
app-1    | read(6, "<?php\n\nnamespace Illuminate\\Supp"..., 5791) = 5791
app-1    | close(6)                                = 0
app-1    | getrandom("\x28\x13\xc4\xce\x48\x3d\xd5\x10", 8, 0) = 8
app-1    | mmap(NULL, 65536, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6be283f000
app-1    | getrandom("\xeb\xf2\x8f\xe3\x5d\xdc\xa5\xfb", 8, 0) = 8
app-1    | close(3)                                = 0
app-1    | rt_sigaction(SIGINT, {sa_handler=0x561de13f54e0, 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=0x7f6be561c050}, NULL, 8) = 0
app-1    | rt_sigprocmask(SIG_UNBLOCK, [INT], NULL, 8) = 0
app-1    | rt_sigaction(SIGTERM, {sa_handler=0x561de13f54e0, 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=0x7f6be561c050}, NULL, 8) = 0
app-1    | rt_sigprocmask(SIG_UNBLOCK, [TERM], NULL, 8) = 0
app-1    | munmap(0x7f6be284f000, 65536)           = 0
app-1    | close(4)                                = 0
app-1    | sendto(5, "\1\0\0\0\1", 5, MSG_DONTWAIT, NULL, 0) = 5
app-1    | close(5)                                = 0
app-1    | munmap(0x7f6be2200000, 2097152)         = 0
app-1    | munmap(0x7f6be2000000, 2097152)         = 0
app-1    | munmap(0x7f6be1e00000, 2097152)         = 0
app-1    | munmap(0x7f6be1800000, 2097152)         = 0
app-1    | munmap(0x7f6be1c00000, 2097152)         = 0
app-1    | munmap(0x7f6be1400000, 2097152)         = 0
app-1    | munmap(0x7f6be1200000, 2097152)         = 0
app-1    | munmap(0x7f6be28be000, 111960)          = 0
app-1    | munmap(0x7f6be2864000, 365576)          = 0
app-1    | munmap(0x7f6be285f000, 16400)           = 0
app-1    | munmap(0x7f6be28da000, 33464)           = 0
app-1    | munmap(0x7f6be28e3000, 46000)           = 0
app-1    | munmap(0x7f6be2806000, 196608)          = 0
app-1    | munmap(0x7f6be1a00000, 2097152)         = 0
app-1    | munmap(0x7f6be0a00000, 2097152)         = 0
app-1    | munmap(0x7f6be0c00000, 2097152)         = 0
app-1    | munmap(0x7f6be0e00000, 2097152)         = 0
app-1    | munmap(0x7f6be1000000, 2097152)         = 0
app-1    | munmap(0x7f6be1600000, 2097152)         = 0
app-1    | munmap(0x7f6be0800000, 2097152)         = 0
app-1    | munmap(0x7f6be2600000, 2097152)         = 0
app-1    | munmap(0x7f6be25af000, 331776)          = 0
app-1    | futex(0x7f6be5f105d8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
app-1    | exit_group(139)                         = ?
app-1    | +++ exited with 139 +++
app-1 exited with code 139

Muvikx avatar Feb 12 '24 15:02 Muvikx

Looks like a segfault trying to get some random bits?

If you are using cryptographically random numbers and don't have enough entropy, I wonder if this could happen...

When spamming the page, and monitoring watch cat /proc/sys/kernel/random/entropy_avail, it should be well above 100, if it gets near 0 then random things are going to stop working (or at least block IIRC, but no idea how this would be handled in PHP or if it is handled correctly).

withinboredom avatar Feb 12 '24 19:02 withinboredom

I tried to monitor with watch cat /proc/sys/kernel/random/entropy_avail but value is always 256, I tried localy without Docker and segfault appear randomly when i'm on the pulse panel (using livewire)

Muvikx avatar Feb 13 '24 13:02 Muvikx

Looks like it won't crash without octane

Muvikx avatar Feb 13 '24 15:02 Muvikx

I wonder if it is related to other livewire issues reported here?

withinboredom avatar Feb 13 '24 16:02 withinboredom

Would you be able to give me access to the crashing code, even privately?

dunglas avatar Feb 27 '24 21:02 dunglas