Skip to content
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

[Bug]: Segfault with herd php-fpm #1251

Open
looksystems opened this issue Jan 26, 2025 · 5 comments
Open

[Bug]: Segfault with herd php-fpm #1251

looksystems opened this issue Jan 26, 2025 · 5 comments
Labels

Comments

@looksystems
Copy link

Platform

macOS

Operating system version

MacOS Sonoma Version 14.6.1 (23G93)

System architecture

Intel (x86)

Herd Version

Herd 1.14.1 (Build: 39)

PHP Version

php-fpm 8.1 to 8.3 (application incompatible with other versions)

Bug description

Receive a segfault when accessing a content managed page (admin and other pages work just fine)

Same page works just fine if I use ./artisan serve

I've tried 8.1, 8.2 and 8.3, disabling extensions, and disabling zend op cache but have had no luck and am stumped as to what to try next, as I cannot see what is causing the segfault.

This used to work with Herd and php 8.1 (I want to say a few months ago)... unfortunately, I can't recall which release caused the problem.

Question: how can I go about debugging this problem with Herd? Any help or guidance would be much appreciated. Thank you.
eg. how to catch segfault dumps; or rollback to earlier versions of herd; or any other suggestions

Current settings for php.ini 8.3:

curl.cainfo=/Users/adrian/Library/Application Support/Herd/config/php/cacert.pem
openssl.cafile=/Users/adrian/Library/Application Support/Herd/config/php/cacert.pem
pcre.jit=0
output_buffering=4096
extension=/usr/local/Cellar/php/8.3.12/pecl/20230831/yaml.so
extension=/usr/local/Cellar/php/8.3.12/pecl/20230831/v8js.so
memory_limit=-1
display_errors=On
log_errors=On
#opcache.enable=0
#opcache.jit=0
auto_prepend_file=/Applications/Herd.app/Contents/Resources/valet/dump-loader.php
extension=/Applications/Herd.app/Contents/Resources/herd-ext/herd-83-x64.so

extension=/Users/adrian/Library/Application Support/Herd/config/php/83/spx/spx.so
spx.http_enabled=1
spx.http_key=LARAVEL-HERD
spx.http_ip_whitelist="127.0.0.1"
spx.http_ui_assets_dir=/Users/adrian/Library/Application Support/Herd/config/php/83/spx/assets/web-ui

[xdebug]
zend_extension=/Applications/Herd.app/Contents/Resources/xdebug/xdebug-83-x86.so
xdebug.mode=coverage
xdebug.max_nesting_level=1000
xdebug.start_with_request=false
xdebug.start_upon_error=false
xdebug.log_level=0

Steps to reproduce

n/a - only repeatable with my specific application

Relevant log output

[26-Jan-2025 11:52:09] WARNING: [pool herd] child 42103 exited on signal 11 (SIGSEGV) after 1.103975 seconds from start
@issuelabeler issuelabeler bot added the macOS label Jan 26, 2025
@mpociot
Copy link
Member

mpociot commented Jan 26, 2025

Can you come up with a minimal reproducible example code?
Also try disabling other extensions like xdebug to see if this causes the segfault

@looksystems
Copy link
Author

Can you come up with a minimal reproducible example code?

It's rendering this page:

https://www.falriver.co.uk

Unfortunately, it's not straight forward to create a minimal example, as there's a lot of code and content, hence my question...

Question: how can I go about debugging this problem with Herd? Any help or guidance would be much appreciated. Thank you.
eg. how to catch segfault dumps; or rollback to earlier versions of herd; or any other suggestions

Also try disabling other extensions like xdebug to see if this causes the segfault

Yes, tried disabled all extensions.

@mpociot
Copy link
Member

mpociot commented Jan 26, 2025

Even if you would use a previous version of Herd you would still end up with a segfault as this comes from PHP itself. So this would be related to any "recent" PHP Update.

Even though PHP 8.1 in particular received its latest update on November 2024.

Edit: As you mentioned this: so the page that gives you a segfault works with PHP artisan serve? Are you using Herds PHP binaries on the commandline?

@looksystems
Copy link
Author

As you mentioned this: so the page that gives you a segfault works with PHP artisan serve?
Are you using Herds PHP binaries on the commandline?

Yes, I believe so.

From php.ini:

Herd support => enabled

Even if you would use a previous version of Herd you would still end up with a segfault as this comes from PHP itself.

Understood and makes sense to me...

Hence, the question I was asking is not "can you fix this for me?" but "how to debug a segfault with Herd?"

So I can narrow down where the error is happening and either file a bug report with the appropriate team OR find a workaround in my own code.

Thank you!

@mpociot
Copy link
Member

mpociot commented Jan 28, 2025

@looksystems this is really hard to track down I'm afraid.
Your best bet would be to gradually try and track down where in your codebase the error occurs.

Just to reconfirm: did you try and disable all extensions (even the herd extension)?

There might be something in your PHP FPM logs, but I don't think a segfault is going to log anything 🤔

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

No branches or pull requests

2 participants