Skip to content

Instantly share code, notes, and snippets.

@sarim
Created January 3, 2022 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sarim/e8f8b5bb2b3263c5c2e7d68d31bb2f3c to your computer and use it in GitHub Desktop.
Save sarim/e8f8b5bb2b3263c5c2e7d68d31bb2f3c to your computer and use it in GitHub Desktop.
SEGFAULT with symfony cache + http-client in php8.1+symfony6. Works fine in php7.4/symfony5.4
<?php
// composer require symfony/cache
// composer require symfony/http-client
// rm -rf /tmp/symfony-cache/
// php main.php
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\HttpClient\NativeHttpClient;
use Symfony\Component\HttpClient\ScopingHttpClient;
use Symfony\Contracts\Cache\ItemInterface;
require 'vendor/autoload.php';
$cache = new FilesystemAdapter();
// Tried with both Curl and Native client, same crash.
$client = new NativeHttpClient();
$apiClient = ScopingHttpClient::forBaseUri($client, 'https://xkcd.com');
$comicId = '0';
$infos = $cache->get('comic_'.$comicId, function (ItemInterface $item) use ($comicId, $apiClient) {
$response = $apiClient->request('GET', "/info.{$comicId}.json");
return $response->toArray();
});
\print_r($infos);
echo "Success\n";
@sarim
Copy link
Author

sarim commented Jan 3, 2022

GDB

GNU gdb (GDB) Red Hat Enterprise Linux 8.2-16.el8
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/php...Reading symbols from /usr/lib/debug/usr/bin/php-8.1.1-1.el8.remi.x86_64.debug...done.
done.
(gdb) run
Starting program: /usr/bin/php main.php
Missing separate debuginfos, use: yum debuginfo-install glibc-2.28-164.el8.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Missing separate debuginfo for /usr/lib64/php/modules/opcache.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/b4/0a61e586d925b038e4d61a1c8b07b5893564a7.debug
Missing separate debuginfo for /usr/lib64/php/modules/bcmath.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/ed/34bb4cc819e72648a2bcc7c86a4495f9a08ab2.debug
Missing separate debuginfo for /usr/lib64/php/modules/bz2.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/6b/8299b3e63d9e5b6ea712290ef9522e9fe23a9c.debug
Missing separate debuginfo for /usr/lib64/php/modules/calendar.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/22/7805eaa4d950ee181b868a9df2765d601470c1.debug
Missing separate debuginfo for /usr/lib64/php/modules/ctype.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/72/c3359be8f64e69a68fe762489885ed1a426a43.debug
Missing separate debuginfo for /usr/lib64/php/modules/curl.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/c0/a630dddfa5f0076dda0e09010318a35b886fbc.debug
Missing separate debuginfo for /usr/lib64/php/modules/dom.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/f9/ffb2614ba8ec3999c2d5f2750b428e666f4923.debug
Missing separate debuginfo for /usr/lib64/php/modules/exif.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/99/2aa0facb9469219348a2162a90e06f87980542.debug
Missing separate debuginfo for /usr/lib64/php/modules/fileinfo.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/a1/38c5d3443f0ebf9825e3834f0788b52b7b7b82.debug
Missing separate debuginfo for /usr/lib64/php/modules/ftp.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/82/2622cad9f0dce12c9eeb5f2154e42ae2e80af7.debug
Missing separate debuginfo for /usr/lib64/php/modules/gd.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/1e/7df32539437bd70bfcd9a2e6e864d457d1c118.debug
Missing separate debuginfo for /usr/lib64/php/modules/gettext.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/0a/03dd922b4f21221144d2176e0fa24fe3d64ee0.debug
Missing separate debuginfo for /usr/lib64/php/modules/iconv.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/2e/ac49dac6da358fb4303f59343eb4baa26666cb.debug
Missing separate debuginfo for /usr/lib64/php/modules/intl.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/d6/bf6fb3a3ad10542004cb32e7cd873c86c9db2b.debug
Missing separate debuginfo for /usr/lib64/php/modules/mbstring.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/e8/ff7bfe3f6aec95558ecad8d0967c678ee0022b.debug
Missing separate debuginfo for /usr/lib64/php/modules/mysqlnd.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/38/be0ff984d4c4b2cdf37ca4f7ab6458a94a8c4a.debug
Missing separate debuginfo for /usr/lib64/php/modules/pdo.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/11/975c5368d890da4dea0d47148ae2120fdd21c7.debug
Missing separate debuginfo for /usr/lib64/php/modules/phar.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/fb/8cc8efeb7663bdbd6a968cebe63e32c3d4ac01.debug
Missing separate debuginfo for /usr/lib64/php/modules/simplexml.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/d0/544f1f7815c0b0e5de35ea3cd43fa03f10496a.debug
Missing separate debuginfo for /usr/lib64/php/modules/sockets.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/dc/271e6d2a8b45a0443e9adcb279bf68189f6785.debug
Missing separate debuginfo for /usr/lib64/php/modules/sqlite3.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/7c/1fd5877b82753bda0bba0084cce9961be9b616.debug
Missing separate debuginfo for /usr/lib64/php/modules/tokenizer.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/60/9fef6c6fbe4b38b4584bcd0968dea5c97157fc.debug
Missing separate debuginfo for /usr/lib64/php/modules/xml.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/b4/92338f9c0c29c2695b4f74462add0b4c04ba6d.debug
Missing separate debuginfo for /usr/lib64/php/modules/xmlwriter.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/c0/b245963b7e4a8b195c70f247f3c1745ee5d0fe.debug
Missing separate debuginfo for /usr/lib64/php/modules/xsl.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/ee/4324628fe890dbc1a4a5d6a9bc931f5b975918.debug
Missing separate debuginfo for /usr/lib64/php/modules/mysqli.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/27/dfed6771e344760f968a1fdb4d23ae3f231722.debug
Missing separate debuginfo for /usr/lib64/php/modules/pdo_mysql.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/54/210791e75f42b05a20fc77f58009e904134d8f.debug
Missing separate debuginfo for /usr/lib64/php/modules/pdo_sqlite.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/74/74a64f2b04b063d731569a3721ee59f895bf1c.debug
Missing separate debuginfo for /usr/lib64/php/modules/xmlreader.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/e7/59faf5e7915ec34b8998f989499b432ea2d044.debug

Program received signal SIGSEGV, Segmentation fault.
0x000055555574bd3d in zend_closure_get_debug_info (object=0x7ffff3a99300, is_temp=<optimized out>)
    at /usr/src/debug/php-8.1.1-1.el8.remi.x86_64/Zend/zend_closures.c:562
562                     array_init(&val);
Missing separate debuginfos, use: yum debuginfo-install ImageMagick6-libs-6.9.12.34-1.el8.remi.x86_64 brotli-1.0.6-3.el8.x86_64 bzip2-libs-1.0.6-26.el8.x86_64 cyrus-sasl-lib-2.1.27-5.el8.x86_64 expat-2.2.5-4.el8.x86_64 fontconfig-2.13.1-4.el8.x86_64 freetype-2.9.1-4.el8_3.1.x86_64 fribidi-1.0.4-8.el8.x86_64 gd3php-2.3.3-4.el8.remi.x86_64 glib2-2.56.4-156.el8.x86_64 gmp-6.1.2-10.el8.x86_64 gnutls-3.6.16-4.el8.x86_64 graphite2-1.3.10-10.el8.x86_64 harfbuzz-1.7.5-3.el8.x86_64 keyutils-libs-1.5.10-9.el8.x86_64 krb5-libs-1.18.2-14.el8.x86_64 libICE-1.0.9-15.el8.x86_64 libSM-1.2.3-1.el8.x86_64 libX11-1.6.8-5.el8.x86_64 libXau-1.0.9-3.el8.x86_64 libXext-1.3.4-1.el8.x86_64 libXpm-3.5.12-8.el8.x86_64 libcom_err-1.45.6-2.el8.x86_64 libcurl-7.61.1-22.el8.x86_64 libedit-3.1-23.20170329cvs.el8.x86_64 libffi-3.1-22.el8.x86_64 libgcc-8.5.0-4.el8_5.alma.x86_64 libgcrypt-1.8.5-6.el8.x86_64 libgomp-8.5.0-4.el8_5.alma.x86_64 libgpg-error-1.31-1.el8.x86_64 libicu69-69.1-1.el8.remi.x86_64 libimagequant-2.12.5-1.el8.x86_64 libpng-1.6.34-5.el8.x86_64 libpsl-0.20.2-6.el8.x86_64 libraqm-0.7.0-4.el8.x86_64 libselinux-2.9-5.el8.x86_64 libssh-0.9.4-3.el8.x86_64 libstdc++-8.5.0-4.el8_5.alma.x86_64 libtasn1-4.13-3.el8.x86_64 libtiff-4.0.9-20.el8.x86_64 libtool-ltdl-2.4.6-25.el8.x86_64 libunistring-0.9.9-3.el8.x86_64 libuuid-2.32.1-28.el8.x86_64 libxcb-1.13.1-1.el8.x86_64 libxcrypt-4.1.1-6.el8.x86_64 libxml2-2.9.7-9.el8_4.2.x86_64 libxslt-1.1.32-6.el8.x86_64 libyaml-0.1.7-5.el8.x86_64 libzstd-1.4.4-1.el8.x86_64 ncurses-libs-6.1-9.20180224.el8.x86_64 oniguruma5php-6.9.7.1-1.el8.remi.x86_64 openldap-2.4.46-18.el8.x86_64 openssl-libs-1.1.1k-5.el8_5.x86_64 p11-kit-0.23.22-1.el8.x86_64 pcre-8.42-6.el8.x86_64 pcre2-10.32-2.el8.x86_64 php-pecl-imagick-im6-3.6.0-2.el8.remi.8.1.x86_64 php-pecl-mcrypt-1.0.4-5.el8.remi.8.1.x86_64 sqlite-libs-3.26.0-15.el8.x86_64 xz-libs-5.2.4-3.el8.x86_64 zlib-1.2.11-17.el8.x86_64

@sarim
Copy link
Author

sarim commented Jan 3, 2022

Crashes here

Program received signal SIGSEGV, Segmentation fault.
0x000055555574bd3d in zend_closure_get_debug_info (object=0x7ffff3a99300, is_temp=<optimized out>)
    at /usr/src/debug/php-8.1.1-1.el8.remi.x86_64/Zend/zend_closures.c:562
562                     array_init(&val);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment