Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:28915 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48735 invoked by uid 1010); 18 Apr 2007 07:51:16 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 48720 invoked from network); 18 Apr 2007 07:51:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Apr 2007 07:51:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=david.sklar@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=david.sklar@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.132.250 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: david.sklar@gmail.com X-Host-Fingerprint: 209.85.132.250 an-out-0708.google.com Received: from [209.85.132.250] ([209.85.132.250:56966] helo=an-out-0708.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2A/91-32576-FDDC5264 for ; Wed, 18 Apr 2007 03:50:57 -0400 Received: by an-out-0708.google.com with SMTP id c28so92866ana for ; Wed, 18 Apr 2007 00:50:53 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=a26cLu1SAJjc6fiLRIs8zCAnk3TZPUktujOLtfjqL13qzhwNMfsMmXqai/lyDwA2dyg4cMFQ+auIo7y2OKvyVy5h4Lsps1ZV9h6K+JxFO0lOJ3/VnySbKHEGgCwJIhRk6GhCMiJU6pOqX+bYAyYQcF6c3vbmr5fFOwX0AIqKT5I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=pQ9GoYULaHdDnDXdI3dUFrhP3SvMh1jVbAmrbwRLbYzsnMGmQ7tIrfobB/9wNwLLRYBrlc+AhlncCBcOwIxk20lNNfukrer8COOyzKdiT4RM+KhzXJQxNyEPzfeMeCwYl1l8USg7iiwOm8GP2wzSR9wb0i0/FKYfcAIb/WPKcn0= Received: by 10.100.122.8 with SMTP id u8mr135142anc.1176882652545; Wed, 18 Apr 2007 00:50:52 -0700 (PDT) Received: by 10.100.168.17 with HTTP; Wed, 18 Apr 2007 00:50:52 -0700 (PDT) Message-ID: <7cea347c0704180050y45a766c5vdbbc7a541c121eb1@mail.gmail.com> Date: Wed, 18 Apr 2007 09:50:52 +0200 To: internals@lists.php.net In-Reply-To: <46250408.6070608@zend.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7cea347c0704160319x619b26d0s7716e35493e122c4@mail.gmail.com> <4623BDF4.8010005@zend.com> <7cea347c0704170116j3ba50dbbrd7cc36780ead7164@mail.gmail.com> <46250408.6070608@zend.com> Subject: Re: [PHP-DEV] Trapping "memory exhausted" error From: david.sklar@gmail.com ("David Sklar") On 4/17/07, Stanislav Malyshev wrote: > > In my current situation, bail out, but gracefully -- perhaps just send > > a 302 to an error page and exit; maybe instead throw away the output > > buffer and then directly output some friendly error text. > > I think you can do it with shutdown handler, shouldn't it work? I.e. you > can do it this way: > 1. Install shutdown handler > 2. Do something that takes a lot of memory > 3. Memory is exhausted, script is terminated > 4. The memory allocated by "something" is cleaned up, part by the > engine, part manually > 5. Shutdown handler does something like output "sorry, better luck next > time" requiring minimal amount of memory. Ah, excellent, thanks. I'll take a look. This looks like what http://ez.no/doc/components/view/latest/(file)/Execution/ezcExecution.html does (Derick mentions this in the comments at http://php100.wordpress.com/2007/04/16/graceful-recovery/) David