Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21980 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98646 invoked by uid 1010); 21 Feb 2006 23:23:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 98631 invoked from network); 21 Feb 2006 23:23:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2006 23:23:39 -0000 X-Host-Fingerprint: 70.85.46.36 unknown Received: from ([70.85.46.36:39199] helo=prohost.org) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 5E/C6-45151-AF0ABF34 for ; Tue, 21 Feb 2006 18:23:39 -0500 Received: (qmail 16013 invoked from network); 21 Feb 2006 23:09:14 -0000 Received: from prohost.org (HELO ?127.0.0.1?) (70.85.46.36) by prohost.org with SMTP; 21 Feb 2006 23:09:14 -0000 Message-ID: <43FB9D99.5070302@prohost.org> Date: Tue, 21 Feb 2006 18:09:13 -0500 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Nuno Lopes CC: PHPdev References: <005101c6373a$a6ef0170$0100a8c0@pc07653> In-Reply-To: <005101c6373a$a6ef0170$0100a8c0@pc07653> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] recover from a segfault From: ilia@prohost.org (Ilia Alshanetsky) Nuno Lopes wrote: > In the last days I've exchanged some e-mails with PCRE's author because > of one more bug that appeared in our database about segfaults in PCRE > (related to stack overflows). > PCRE can consume a lot of stack, because of backtracking (thus > segfaulting PHP). Yesterday I've discovered that when using the > setrlimit() function, most segfaults can be avoided > (http://mega.ist.utl.pt/~ncpl/php_pcre_stack_limits.txt) :) This sounds like an interesting idea, I think we need to consider it doing for PHP in general rather then jut when PCRE is being used. The only thing is that rather then setting the stack to infinity, perhaps a small value can be used ;-) > I've done a little program for fun to show myself how to catch the > SIGSEGV signals and print a nice message. > (http://mega.ist.utl.pt/~ncpl/break-stack.html) > > So, catching the signal is easy. What about recovery? Doesn't anyone has > experience in this area? Can this be done? (and in most > SAPIs/architectures?) > After SEGV or any memory problem has happened the situation is undefined. Another words you cannot reliably continue the operation of the program. Which is why termination and dumping of core is the lesser of all evils in this case. Ilia