Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103310 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 23257 invoked from network); 9 Oct 2018 10:04:56 -0000 Received: from unknown (HELO NAM04-CO1-obe.outbound.protection.outlook.com) (40.107.69.96) by pb1.pair.com with SMTP; 9 Oct 2018 10:04:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=RWSoftware.onmicrosoft.com; s=selector1-zend-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mPPWcip/9eLAwTKjV9BN/0CEe06ZP5XR+9Z/7L5E4Ws=; b=dozDdeLTntlVhB6y96tBZivxL1iHPx/M6Ry+YNu8iy9ElLcHrOfZwqfLL0uddAnKmuaEFAieu5DaIb7dX9o/PCvlBRX1JBnv69PXNbdAe1LDBKl79MG5kb+H08KVk92RcoCwc/tmXFb8t8HTlOHoHQi6+aj+Ky3KfpDgdxPpAwc= Received: from BY1PR02MB1260.namprd02.prod.outlook.com (10.162.109.14) by BY1PR02MB1259.namprd02.prod.outlook.com (10.162.109.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.21; Tue, 9 Oct 2018 06:16:10 +0000 Received: from BY1PR02MB1260.namprd02.prod.outlook.com ([fe80::8051:9554:9274:3a2e]) by BY1PR02MB1260.namprd02.prod.outlook.com ([fe80::8051:9554:9274:3a2e%4]) with mapi id 15.20.1228.020; Tue, 9 Oct 2018 06:16:10 +0000 To: Rowan Collins , PHP internals Thread-Topic: [PHP-DEV] die('zend_mm_heap corrupted'); // TODO: Better error message Thread-Index: AQHUXvAdvewH1VlUzkCu+3rXm98r1qUWb7Ol Date: Tue, 9 Oct 2018 06:16:10 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=dmitry@zend.com; x-originating-ip: [212.232.72.197] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BY1PR02MB1259;6:ViJPxwlN3dRQN0NFX+7XoZXK3g9/BqS48eyus2fsU1+pegR7l4KcK5ShdMu6y8Ow037dRqYGsx3HzHqM94jqcVCOw+Yvqdca7Qgclj7Jjd29U6GjT+MEv43yk5LYdJAxTas7Ig6t8NIyCtBWNyT4JXnl+Cq6KBBIFWubWls5efYai03MWB79NkpQHrvHXw3neZDRZ6KyQIEBbwTLvglRXPtku2JbhmVnrbAodaRisG0ZyXaKJAcjb7eiHnzcendtaLTH3VNRWqf7r+mPuDw+9Z7iQ5ECMjSaM+dztGp9eHp8V/X0I2u97jfSJzSv7FC23DBn1AE8gFLp52uVu/NGLFhle2foXeQilFGThHkyxLlutpWCVXlwNuQYowW9HzqqXcFdtM783KNMikN9KufKG/ga3wtggfFogwo8XKbxOUiWjVfMVigKUXsScGhH5vmLpnQ/4wwjUj3+Fvtklh7ngQ==;5:4FvkOm8nofoW4tIxv1l9k5RpwFKsPG63TNAQnWTKnogv7vKGT0w7NTS3RvLtBYfomF0Zvo14xqOwLg1ocVtfinNVoXRBnhfx0qM/xx9HRb5qsc5gOfgeA4b+htjr/GtvLXWRIjFrd0z8kNlkOj1WxnOxWHtmwHuZqIviGRvG6WI=;7:0/lEUl2cpRgTBHcULh8Zfr1E4+v2H9ArdhO04Rjcl3x+bBtSWQIym1tENfRJq23bDJQg4WIIyuJ9PBsZPML1o9eQOuG8XoGh3enQljzlsiIvNvChF2hmPvKEMSqTGpvWbTgNpNtCtADprz1RKj2KgkGNv5BCcgFQiFfDgEpVq1TpQ6HIkuBMBXIo+0V5MCBnsyXIORNOelWxOeJQlZ0ZnZh9yaZ3CiFNfLn/+XqxoAmCtmrzfVZL8GVGckmCzWmA x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: b5ba572d-d86d-4294-02cf-08d62daeb511 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BY1PR02MB1259; x-ms-traffictypediagnostic: BY1PR02MB1259: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(85827821059158)(158342451672863)(166708455590820); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231355)(944501410)(52105095)(3002001)(10201501046)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051);SRVR:BY1PR02MB1259;BCL:0;PCL:0;RULEID:;SRVR:BY1PR02MB1259; x-forefront-prvs: 08200063E9 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(39850400004)(136003)(396003)(346002)(366004)(53754006)(199004)(189003)(53936002)(9686003)(6306002)(54896002)(55016002)(606006)(236005)(6436002)(316002)(229853002)(7736002)(8676002)(81166006)(81156014)(105586002)(68736007)(106356001)(8936002)(2900100001)(256004)(14444005)(74316002)(25786009)(19627405001)(39060400002)(6246003)(33656002)(15650500001)(5660300001)(26005)(186003)(102836004)(97736004)(446003)(11346002)(66066001)(7696005)(76176011)(486006)(53546011)(476003)(6506007)(71200400001)(71190400001)(99286004)(2906002)(6116002)(3846002)(14454004)(86362001)(966005)(478600001)(110136005)(5250100002)(6606003);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR02MB1259;H:BY1PR02MB1260.namprd02.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: zend.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: oI67RgO9h1zTrNN5kiZYXa1wF1/d9mcvxUmlbtHFbHHLUooX6tln41c7xLgjJFuzgzPWJ9NOoJaggM95CdZn9FgIYeXCYXfvhjdjw/ZJshDuiTrXvvi1LtK/egHUhmELD2DdzSQ8HrbhPH+fOz/RRy4RPhyo0jtGknFtw2D1AWHdBFluoqqNdCbWcvMpFz5wHf8Nv58SZU4BKTcngecueT5MTShAHuti+Gen1u4PcEHA4vA2wCobIXpfZSS5X5wS1bj/tEZJZtRKBm+Syg9iMnzeDb6ct8bM9fDoMUgMswOLuj3Ew2G2/9CbojJIQgMtOPAztFtXtA16O6FMczbxYRtQDWLtfZes2A3KFZDd/Vo= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/alternative; boundary="_000_BY1PR02MB1260C7551F3214E00BD47F9FBFE70BY1PR02MB1260namp_" MIME-Version: 1.0 X-OriginatorOrg: zend.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5ba572d-d86d-4294-02cf-08d62daeb511 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Oct 2018 06:16:10.1060 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 32210298-c08b-4829-8097-6b12c025a892 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR02MB1259 Subject: Re: [PHP-DEV] die('zend_mm_heap corrupted'); // TODO: Better error message From: dmitry@zend.com (Dmitry Stogov) --_000_BY1PR02MB1260C7551F3214E00BD47F9FBFE70BY1PR02MB1260namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Rowan, This error message is triggered when Zend MM used in improper way, e.g. inv= alid pointer free, etc. MM can't provide useful information about the context and reason. The best way to find the reason of the problem is running php under valgrin= d. $ USE_ZEND_ALLOC=3D0 valgrind php ... In most cases valgrind will show incorrect MM operations and their history. Thanks. Dmitry. ________________________________ From: Rowan Collins Sent: Monday, October 8, 2018 1:17:06 PM To: PHP internals Subject: [PHP-DEV] die('zend_mm_heap corrupted'); // TODO: Better error mes= sage Hi all, We recently had an error in production which was hard to reproduce, hard to debug, and turned out to be a bug in an extension. One of the oddest symptoms was that the PHP code seemed to run to completion, but the request was never logged by Apache. The only thing logged was the words "zend_mm_heap corrupted", in the Apache error log. As far as I can see, this ultimately comes from zend_mm_panic [1], which (on non-Windows non-debug builds) is simply: fprintf(stderr, "%s\n", message); exit(1); Frustratingly, this error: - Doesn't contain a timestamp - Doesn't contain any context of where the error happened (not even a hint that this happened during shutdown rather than execution) - Doesn't mention PHP, or look like the messages PHP would normally log - Doesn't log to the PHP error log - Doesn't register as an error in Apache itself The server in question was running PHP as an Apache module in pre-fork mode; in that configuration, stderr gets slurped into the Apache error log without annotation, and the exit(1) silently terminates the connection and logs nothing. I suspect this is one of those last-ditch errors where there is a risk of causing further errors if global data is accessed, but is there any way this message can be improved, at least to format it more like other PHP errors? [1] https://github.com/php/php-src/blob/1154f6f70a3e4ee083f1bc42d83c190ad68f386= 2/Zend/zend_alloc.c#L348 Regards, -- Rowan Collins [IMSoP] --_000_BY1PR02MB1260C7551F3214E00BD47F9FBFE70BY1PR02MB1260namp_--