Return-Path: X-Original-To: apmail-incubator-lucy-dev-archive@www.apache.org Delivered-To: apmail-incubator-lucy-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1E7F87625 for ; Wed, 9 Nov 2011 15:01:46 +0000 (UTC) Received: (qmail 11028 invoked by uid 500); 9 Nov 2011 15:01:46 -0000 Delivered-To: apmail-incubator-lucy-dev-archive@incubator.apache.org Received: (qmail 11004 invoked by uid 500); 9 Nov 2011 15:01:45 -0000 Mailing-List: contact lucy-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucy-dev@incubator.apache.org Delivered-To: mailing list lucy-dev@incubator.apache.org Received: (qmail 10988 invoked by uid 99); 9 Nov 2011 15:01:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2011 15:01:45 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [192.203.201.122] (HELO barracuda01.mpr.org) (192.203.201.122) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2011 15:01:39 +0000 X-ASG-Debug-ID: 1320850875-0223c508fc2253d0001-2JKy5F Received: from HQMAIL08.mpr.org (hqesnode02.mpr.org [10.2.2.101]) by barracuda01.mpr.org with ESMTP id szkdwXHZATpi2UUq; Wed, 09 Nov 2011 09:01:15 -0600 (CST) X-Barracuda-Envelope-From: peter@peknet.com X-ASG-Whitelist: Client Received: from mail.mpr.org ([10.2.2.87]) by HQMAIL08.mpr.org with Microsoft SMTPSVC(6.0.3790.4675); Wed, 9 Nov 2011 09:01:15 -0600 Received: from pkarmanpc ([10.2.8.182]) by mail.mpr.org with Microsoft SMTPSVC(6.0.3790.4675); Wed, 9 Nov 2011 09:01:15 -0600 Received: from [127.0.0.1] (localhost [127.0.0.1]) by pkarmanpc (Postfix) with ESMTP id B6A0A21A04B; Wed, 9 Nov 2011 09:01:14 -0600 (CST) Message-ID: <4EBA95BA.5020205@peknet.com> Date: Wed, 09 Nov 2011 09:01:14 -0600 From: Peter Karman Reply-To: peter@peknet.com User-Agent: Thunderbird 2.0.0.24 (X11/20101027) MIME-Version: 1.0 To: Marvin Humphrey CC: lucy-dev@incubator.apache.org References: <20111109013246.GA26278@rectangular.com> <4EB9DCFF.4040706@peknet.com> <20111109053348.GA26543@rectangular.com> X-ASG-Orig-Subj: Re: [lucy-dev] Non-deterministic destruction in Perl 5.15 In-Reply-To: <20111109053348.GA26543@rectangular.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 09 Nov 2011 15:01:15.0290 (UTC) FILETIME=[6D792FA0:01CC9EF0] X-Barracuda-Connect: hqesnode02.mpr.org[10.2.2.101] X-Barracuda-Start-Time: 1320850875 X-Barracuda-URL: http://barracuda.mpr.org:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at mpr.org X-Virus-Checked: Checked by ClamAV on apache.org Subject: Re: [lucy-dev] Non-deterministic destruction in Perl 5.15 Marvin Humphrey wrote on 11/08/2011 11:33 PM: > It's not surprising that SWISH::3 would pass its tests. You haven't set up > tests to validate behavior under refcount leakage, have you? I do, actually. http://cpansearch.perl.org/src/KARMAN/SWISH-3-1.000000/t/07-refcnt.t among others. I use a ref_cnt counter on the underlying C struct, not relying on the Perl ref counting. So my DESTROY blocks are conditional on that ref_cnt. void DESTROY(self) SV *self; PREINIT: swish_3 *s3; CODE: s3 = (swish_3*)sp_extract_ptr(self); s3->ref_cnt--; if (s3->ref_cnt < 1) { sp_Stash_destroy( s3->stash ); } but SWISH::3 is far less complex than Lucy in terms of the number of classes and code generation etc, so I was willing to hand-code all the ref counting etc of internal objects, etc. > > What I'm suggesting if a user writes a program which leaks Lucy objects, and > if we disconnect that "tripwire" exception without implementing the > PERL_PHASE_DESTRUCT wrapping, that program may segfault during global > destruction in Perl 5.15. > > Most small programs don't leak, because most small programs don't have > circular references. Circular refs are pretty common in big, complex > programs, though. > > If SWISH::3 -- or Perl/Tk, or whatever else -- has complex objects which count > on deterministic order of destruction, I believe that the potential for > segfaulting during global destruction exists in Perl 5.15. > I agree with all that. I think your patch is the right choice. -- Peter Karman . http://peknet.com/ . peter@peknet.com