View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002221 | Xdebug | Uncategorized | public | 2023-12-01 09:58 | 2023-12-15 12:24 |
Reporter | Warxcell | Assigned To | derick | ||
Priority | none | Severity | crash | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Product Version | 3.3.0 | ||||
Target Version | 3.3dev | Fixed in Version | 3.3.1 | ||
Summary | 0002221: Crash when other extensions run PHP code without the stack being initialised yet | ||||
Description | [ 5863.067928] php[741299]: segfault at 8 ip 00007fe78b0b098b sp 00007ffe7f860700 error 4 in xdebug.so[7fe78b0ab000+34000] likely on CPU 3 (core 3, socket 0) during | ||||
Steps To Reproduce | Not sure how to reproduce. | ||||
Additional Information | enviornment info: PHP 8.2.13 (cli) (built: Nov 30 2023 23:58:09) (NTS) inside image | ||||
Tags | No tags attached. | ||||
Operating System | alpine | ||||
PHP Version | 8.2.0-8.2.9 | ||||
|
I believe we are hitting the same issue Program received signal SIGSEGV, Segmentation fault. looks like stack is for some reason null here php -v CentOS Linux release 7.9.2009 (Core) |
|
I included not correct php -v (without xdebug enabled) PHP 8.2.13 (cli) (built: Nov 21 2023 09:55:59) (NTS gcc x86_64) |
|
Also xdebug 3.2.2 works without crashing (while keeping everything else the same), I tried to find what could be the reason in github diff, but I'm not familiar with xdebug code base enough to be able to find anything |
|
We ran into the same issue this morning. Our quick fix was to revert to 3.2.2. It looks like 3.3.0 in combination with certain other extension causes the sigfault. In our case it's in combination with Swoole. I'm currently building a Dockerfile to reproduce the issue. Dropping it here shortly |
|
The Dockerfile attached builds an image that runs into the segfaults with 3.3.0. I must add to this, that we intentionally didn't update Swoole yet in our product. The Dockerfile contains version 5.0.3 of Swoole because of this very reason. Hopefully this provides people smarter than me enough information to understand why this happens. Dockerfile (1,109 bytes)
FROM php:8.2.13-cli-alpine3.18@sha256:bc920d642c7ced77868277f93d0ed6182ba1abd75d483da4663ca2cc11aeb328 RUN set -ex \ && apk update \ && apk add --no-cache postgresql-dev \ && apk add --no-cache --virtual .build-requirements $PHPIZE_DEPS linux-headers curl-dev \ && docker-php-ext-install sockets \ && docker-php-source extract # swoole extension RUN mkdir /usr/src/php/ext/swoole \ && curl -sfL https://github.com/swoole/swoole-src/archive/v5.0.3.tar.gz -o swoole.tar.gz \ && tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole \ && docker-php-ext-configure swoole --enable-swoole-pgsql --enable-openssl --enable-sockets --enable-swoole-curl \ && docker-php-ext-install -j$(nproc) swoole \ && rm -f swoole.tar.gz $HOME/.composer/*-old.phar RUN docker-php-source delete \ && apk del .build-requirements # xdebug extension RUN apk add --no-cache --update --virtual build-requirements linux-headers $PHPIZE_DEPS \ && pecl install xdebug \ && docker-php-ext-enable xdebug \ && apk del build-requirements \ && rm -rf /usr/src/php* |
|
If someone wants to check out a github thread about this issue on Laravel/sail, here it is: https://github.com/laravel/sail/issues/641 |
|
Szpadel, can you type "bt full" on the gdb prompt after you see "print xdebug_globals.globals.base.stack" — looks like some conflict with blackfire. |
|
sure, let me know if you need anything else (gdb) bt full |
|
Szpadel, I think you can work around this, by making sure Xdebug gets loaded after blackfire (so that it shows up below blackfire in The real issue is, is that improved the way how Xdebug overrides functions, and by doing so moved the check whether the stack was empty into the wrong place. My test suite doesn't cover it, as things like blackfire are closed source. I think the patch in https://github.com/xdebug/xdebug/pull/934 — You can also check out this by cloning my fork (git@github.com:derickr/xdebug.git) and using the |
|
Thanks Derick, I can confirm that your fix addresses a similar crash I was seeing with the Datadog tracing extension. |
|
|
|
The fix in https://github.com/xdebug/xdebug/commit/5e13c7b7b1d2b2efc21098bc47d2047878d714a7 is not complete, Swoole still has a segfault. This is my pr: https://github.com/xdebug/xdebug/pull/938 |
|
|
|
I have released Xdebug 3.3.1, in which I believe this is now all fixed. Please try it, and if there are still issues, please file a new ticket. |
Date Modified | Username | Field | Change |
---|---|---|---|
2023-12-01 09:58 | Warxcell | New Issue | |
2023-12-01 10:16 | Szpadel | Note Added: 0006692 | |
2023-12-01 10:17 | Szpadel | Note Added: 0006693 | |
2023-12-01 10:21 | Szpadel | Note Added: 0006694 | |
2023-12-01 10:28 | lv2u | Note Added: 0006695 | |
2023-12-01 10:46 | lv2u | Note Added: 0006696 | |
2023-12-01 10:46 | lv2u | File Added: Dockerfile | |
2023-12-01 12:09 | Toguy | Note Added: 0006697 | |
2023-12-01 13:56 | derick | Assigned To | => derick |
2023-12-01 13:56 | derick | Status | new => feedback |
2023-12-01 13:56 | derick | Note Added: 0006698 | |
2023-12-01 18:44 | Szpadel | Note Added: 0006699 | |
2023-12-02 19:17 | derick | Note Added: 0006700 | |
2023-12-02 19:17 | derick | Target Version | => 3.3dev |
2023-12-02 19:17 | derick | Summary | php command killed with exit code 319 => Crash when other extensions run PHP code without the stack being initialised yet |
2023-12-04 19:40 | edsrzf | Note Added: 0006702 | |
2023-12-06 17:59 | derick | Note Added: 0006706 | |
2023-12-06 18:00 | derick | Status | feedback => closed |
2023-12-06 18:00 | derick | Resolution | open => fixed |
2023-12-06 18:00 | derick | Fixed in Version | => 3.3dev |
2023-12-08 02:27 | Yurun | Note Added: 0006715 | |
2023-12-12 18:37 | derick | Status | closed => confirmed |
2023-12-12 18:37 | derick | Note Added: 0006725 | |
2023-12-13 12:14 | derick | Status | confirmed => closed |
2023-12-14 17:32 | derick | Fixed in Version | 3.3dev => 3.3.1 |
2023-12-15 12:24 | derick | Note Added: 0006729 |