dunglas / frankenphp

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

Improve debugging frankenphp documentation to be able to help with debugging a reproducible crash #336

Closed marinhekman closed 5 months ago

marinhekman commented 11 months ago

Hi, we are still using Symfony Docker without frankenphp in our MSP Challenge project , so I created a branch with frankenphp. We encounter reproducible crashes. See 2 crash call-stacks from the frankenphp log crash1.txt crash2.txt

I would like to help debugging for more information, so could you instruct me how to proceed? So on the contributing page there is some explanation about "Debugging Segmentation Faults in GitHub Actions" . So could you elaborate these steps a bit more ? What do these steps do , what will be the output I could give you here to resolve this issue?

marinhekman commented 10 months ago

@dunglas or anybody else that knows can reply questions I have about https://github.com/dunglas/frankenphp/blob/main/CONTRIBUTING.md:

Any links for more info will be appreciated as well.

dunglas commented 10 months ago

Just running this should be good enough (in the FrankenPHP repo).

docker build -t frankenphp-dev -f dev.Dockerfile .
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -p 8080:8080 -p 443:443 -v $PWD:/go/src/app -it frankenphp-dev -v /path/to/my/php-app:/php-app

If you want to debug your app, mount it as a volume in the Docker image (as done in the example).

To use GDB, take a look at https://sourceware.org/gdb/current/onlinedocs/gdb.html/. This should look more or less to:

cd /php-app
gdb --args frankenphp run
# Run the request that triggers the crash
bt

You should get a backtrace!

marinhekman commented 10 months ago

@dunglas Thanks, I will give it a try .

dunglas commented 5 months ago

We now have a dedicated documentation entry: https://frankenphp.dev/docs/contributing/#debugging-segmentation-faults-with-static-builds

sneycampos commented 4 months ago

@dunglas do you have any Dockerfile with debug enabled to run a laravel/symfony application? i'm having a segmentation fault using the debian image (running in OSX via Orbstack) after a few simple https requests and trying to debug to send the traces