Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108326 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53897 invoked from network); 30 Jan 2020 04:32:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 30 Jan 2020 04:32:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 71C4D1804F2 for ; Wed, 29 Jan 2020 18:43:38 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8075 40.64.0.0/10 X-Spam-Virus: No X-Envelope-From: Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-oln040092011064.outbound.protection.outlook.com [40.92.11.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 29 Jan 2020 18:43:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eBCotH8u5lzVH38b3CcJybI9CF+OjQ+B1po2C6a9+jeBpoC+5MyHAwD+1tOYW/gv423lascOA63opzRLmA8XQKWN0XZw/4a9vKNYCxDM8NPbQOBi4zZU6ueN9b+tEubHtelgvA7raAkjdbT8o/d3xofHpRjhM3mk3tIeTwxRbBSEuE1JUvSPP7DGz4sS680QpiObPQNkyBiXTkjcKYzD2WQmTs2/XOFEW70QrGI0IRK5KLA+PnMyHs+b7fQBZOJOQQts6B8s0G/ZoE8P3Jz8y90+cwfb9zc6Eadys5OgfNf1lTls4kaA1IDwHS3qtzZ08nP2an/pLFx4xBhzgaLMwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qlyQKZmkLcMPcqr3+592N1danhwyQXk6B2McEKvQ41E=; b=djacYOUZbnGhsqr48k1TjBRj5HaI5Rt8VIYCt50LJdsYzhJwJQOrFGY7a65nAirfNbNqQWkw1G5rpCE3X0Ps9BX95AjnrORKU+4/YwloHwjvCZzhY7Nc80QoJVmByaeSQygpyGDVqQAwraG/EHwl0qIKqmCLvDGT/UmynPwsSpugwynBEZ2ZrdFehikCoFDpMwBLqj/IJJDGNVpAt2/vMwlhqDtBXi/6m3+rXAcYytVZzyiFkYEdKa4oYslQ5xRK8Ks+wRPbkhFRrnTcr0478puXuLsUArz6A3OyDg5S9BJgrUmtuMrihvcRz8axUBJsgB/nihAV/zpZqock4wzjzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qlyQKZmkLcMPcqr3+592N1danhwyQXk6B2McEKvQ41E=; b=M++JgElgu1ni2qiVvQu6EuecWQ+bGzIZkU6hzri2hxWjhyhDyeQJyn7MF570gY1jRD7TTQFSgIhFMJ3VPnizfUlTDlQvxuNBXAd+wk2RNkJ7kzJ13jl/ZFftbm+kLftgqg9GGqeBZTiaI9CRfGKXk2g1xD2rOEaYoV6+UGX3qAq18boLbiOcJ7gzSxzdIQYs4D2VIoOVxiPquV/6iZO17vOKSFqg1EyrBK6gga4c2OFIPaADpkzVX59IOuroJ6gwuM9NoACugJeBy1+Co5oBzBBYqh/PTgjLtkYUBB1QdOqkkBHxQkEDtiP+OjYaOFPgguGGzzcaFdQjB/bFh0UNYA== Received: from SN1NAM04FT003.eop-NAM04.prod.protection.outlook.com (10.152.88.59) by SN1NAM04HT181.eop-NAM04.prod.protection.outlook.com (10.152.89.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.18; Thu, 30 Jan 2020 02:43:35 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com (10.152.88.59) by SN1NAM04FT003.mail.protection.outlook.com (10.152.88.174) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.25 via Frontend Transport; Thu, 30 Jan 2020 02:43:35 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com ([fe80::29e3:53bf:163e:5beb]) by DM5PR07MB3067.namprd07.prod.outlook.com ([fe80::29e3:53bf:163e:5beb%3]) with mapi id 15.20.2665.027; Thu, 30 Jan 2020 02:43:35 +0000 To: Benjamin Morel , "bishop@php.net" CC: PHP Internals Thread-Topic: [PHP-DEV] How to debug a segmentation fault? Thread-Index: AQHV1fgMRGyLBah1gUGPr6kq4bV9NagB5IcAgABe1YCAADypQQ== Date: Thu, 30 Jan 2020 02:43:35 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:A3EEC3776132CC6A6293BE473658A8A01CDFC494F3970B1B345C8F524C0E0061;UpperCasedChecksum:4DF67CAF8DFF8556F51B0081CDC2C91A45CE0F46D7E1B60C132279DC2F4B3B12;SizeAsReceived:7176;Count:46 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [ntws0PMvY9yrCMiErtJVGsgf9wzYtD23] x-ms-publictraffictype: Email x-incomingheadercount: 46 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 243cf98e-43fa-4408-2e67-08d7a52e33d6 x-ms-traffictypediagnostic: SN1NAM04HT181: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: sWjH5rivKjM04w3LpAW3JAZZPJ7DjQlcaMAR4jpheyscSQ5BaWWUCIBznXeW0D/ZhsV8boPP/hUDI3t59jxAD3tvJWF6ae8T3NrOUMt7j4O2UxH8XapfeP295rh1s/Hm2GchVgC0/HUhAgSScXaxACgubt++rG11Jh+rL2sdzVVoFrwbW7DCw4aSaYon2JWdFaMJiuxTxsJU1phSfmXYBGlZVyUYdpKBTeA7Pb45bjU= x-ms-exchange-antispam-messagedata: uLRAQ59Y31a94IrAdxTY+atl/2j7j221GwSYlYcJq4CN12WATFHO9pLuRPDVwWZViL1A7F+n8dF9o0r9kiJC9c7wEBHgILX8T38l8pnV82vIn0Z5Bh9Dv0CRbGHDDkk/MBOdoEUV+Gc5Lgd0vLljMA== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 243cf98e-43fa-4408-2e67-08d7a52e33d6 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jan 2020 02:43:35.2268 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM04HT181 Subject: Re: [PHP-DEV] How to debug a segmentation fault? From: tysonandre775@hotmail.com (tyson andre) >> I'm encountering a SIGSEGV in PHP-FPM on PHP 7.4.2 in a Symfony app. The= =0A= >> bug seems to happen during the rendering of a Twig template; this makes = it=0A= >> hard for me to pinpoint the code that triggers the segfault.=0A= >=0A= > I'm not sure if I could gather helpful enough info about the issue, but= =0A= > anyway I filed a bug here:=0A= > https://bugs.php.net/bug.php?id=3D79194=0A= =0A= >> gdb output for the segfault: (only showing the first 10 entries, it goes= on and on for more than 20000 entries=97there may be many more, I gave up = after that)=0A= =0A= > #0 0x00007f7ea5fdc6d1 in bf_zend_execute () from /usr/lib64/php/modules/= blackfire.so=0A= > #1 0x0000560bec0b20c0 in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /u= sr/src/debug/php-7.4.2-1.fc31.remi.x86_64/Zend/zend_vm_execute.h:1714=0A= > #2 execute_ex (ex=3D0x7f7e99d6b2c0) at /usr/src/debug/php-7.4.2-1.fc31.r= emi.x86_64/Zend/zend_vm_execute.h:53821=0A= > #3 0x00007f7ea5fdc6f8 in bf_zend_execute () from /usr/lib64/php/modules/= blackfire.so=0A= > #4 0x0000560bec0b20c0 in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /u= sr/src/debug/php-7.4.2-1.fc31.remi.x86_64/Zend/zend_vm_execute.h:1714=0A= > #5 execute_ex (ex=3D0x7f7e99d6b2c0) at /usr/src/debug/php-7.4.2-1.fc31.r= emi.x86_64/Zend/zend_vm_execute.h:53821=0A= =0A= The symptoms sounds like you have a global function (each call handled in Z= END_DO_FCALL_SPEC_RETVAL_USED_HANDLER) that's recursively calling itself, i= nfinitely. The stack trace doesn't say which.=0A= When blackfire is used, it seems to use C's call stack, which leads to a st= ack overflow.=0A= When blackfire is used, the C PHP engine manages a different stack and does= n't recurse, so it doesn't have a stack overflow, and the memory leak would= be slower.=0A= =0A= Infinite recursion leading to a segfault is **a known bug with no plans to = be fixed that I know of,** which I've encountered many times.=0A= =0A= You may also want to try running the same code with xdebug - Xdebug will th= row/log an error if you recurse more than max_nesting_level(defaults to 100= ).=0A= https://xdebug.org/docs/basic=0A= That will give you the php function that calls itself.=0A= =0A= If you can reproduce the issue consistently, you may also want to look into= https://github.com/adsr/phpspy (It has a top-like mode:)=