Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121436 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 1815 invoked from network); 19 Oct 2023 18:55:07 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Oct 2023 18:55:07 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A1BCA18053F for ; Thu, 19 Oct 2023 11:55:06 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 ; Thu, 19 Oct 2023 11:55:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1697741704; bh=bYKIX2U9ip5RxBd+BcP+Vz+syLxORSrwhIhwWzxeygc=; h=Message-ID:Date:MIME-Version:From:Subject:To:Content-Type:from:to: cc:subject:message-id; b=Snf4gFLSbQwwYKKSlvQMFLvFPYE6R0KgTq/kUQu/lnbHwniJn3w5bWQQrAV368niK dfHE8hXO3kSdta+fEoK0ONB8eozL+bO5n442ju0MUjDWkX6taDp3OMgWGAx1pd1Tvj m2Gx1ubMdGwzRSVg+8IXNmSl1uWKBGmDnPCRc2NDy0Ovmjw7nTkCNECk9x7GkbYkbP atbLeW/taeyvwo29CeDq1/G1sBiUZWkpuoorI7zePk1nrMnLnWLL3cS2teedJpkKHw jXOYz6vAbhypa0SmV5r3JoBzc3pacKcNKfe6aNM75kDWaBZeXRrdqAQlZHVpJXPqO3 AdgopyeBJI9/A== Message-ID: Date: Thu, 19 Oct 2023 20:55:01 +0200 MIME-Version: 1.0 To: PHP internals Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: OOM error messages From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi A while ago I noticed that the current error messages when the memory_limit is reached / when an OOM condition is encountered are misleading, because PHP allocates memory from the operating systems in bulk in larger chunks and the size of the chunk is what is checked against the memory limit. However the error message reports the much smaller actual allocation, leading to confusion, because the last known memory usage + the reported allocation would be smaller than the memory limit. I've created a PR to improve the error message to include all relevant sizes: https://github.com/php/php-src/pull/11763 Unfortunately that PR did not get much discussion, much less a decision whether or not it makes the situation better. I believe it does and thus I'm sending this email to solicit additional opinion. Please check the PR for additional information about the proposed rephrased message. You can see the example output from the adjusted tests. Before merging the PR will likely require some cleanup and there are two different tests that fail in CI due to a different allocation path being hit compared to my local machine. Someone more knowledgeable will need to decide if the behavior is correct, especially since one of the outputs indicates an uint64 underflow (18446744073707454792) somewhere. However I'd first like to gauge some opinions before spending more time on investigating that. Best regards Tim Düsterhus