Return-Path: X-Original-To: apmail-subversion-dev-archive@minotaur.apache.org Delivered-To: apmail-subversion-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5E90617C59 for ; Sat, 21 Mar 2015 02:25:50 +0000 (UTC) Received: (qmail 14501 invoked by uid 500); 21 Mar 2015 02:25:50 -0000 Delivered-To: apmail-subversion-dev-archive@subversion.apache.org Received: (qmail 14432 invoked by uid 500); 21 Mar 2015 02:25:50 -0000 Mailing-List: contact dev-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@subversion.apache.org Received: (qmail 14422 invoked by uid 99); 21 Mar 2015 02:25:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Mar 2015 02:25:49 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of vega.james@gmail.com designates 209.85.192.54 as permitted sender) Received: from [209.85.192.54] (HELO mail-qg0-f54.google.com) (209.85.192.54) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Mar 2015 02:25:43 +0000 Received: by qgez102 with SMTP id z102so19203050qge.3 for ; Fri, 20 Mar 2015 19:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=h2QztM+fnE1gSGFqhxFeEGy3baQJCR9GkB/FB5fKTXE=; b=zsURAdxFcTwZFmzMT8WnRl4srDrueJX4yGHa9WmmEfw5nXv4gOGpTdXufBBDHNCNI2 GDug0fx6MMnyu7q2Pdc1umk2FHE2M8WxaaKQfvqTo0zTL6mKr8PfjVqG3kX/uIiFwr58 XMAj9kpEvd1KbnD/Iu+L7IV7gaOlBMbMUgBdfIMGlRnQwUe08UqtJzb40OqSpgoySrxx B6TyHhpmZV3M0p4l3ceK3mbwdhA/Vwz+5roA1y/4EHmq7Rb4+A/Ax1xeeZ6HFksGDQn0 v0A5fY3hEcx85+w4BrKgAQpsdBk3W9YrMp1PWEEP3l0aav5O7Qz9myrVWJ5m5Xl8sLaf 9Ubg== X-Received: by 10.140.233.129 with SMTP id e123mr110114505qhc.23.1426904722641; Fri, 20 Mar 2015 19:25:22 -0700 (PDT) Received: from freya.jamessan.com (pool-71-162-119-45.bstnma.fios.verizon.net. [71.162.119.45]) by mx.google.com with ESMTPSA id b18sm4297362qkh.36.2015.03.20.19.25.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Mar 2015 19:25:21 -0700 (PDT) Sender: James McCoy Received: from jamessan by freya.jamessan.com with local (Exim 4.84) (envelope-from ) id 1YZ96F-0002cV-Gj; Fri, 20 Mar 2015 22:25:19 -0400 Date: Fri, 20 Mar 2015 22:25:19 -0400 From: James McCoy To: Philip Martin Cc: dev@subversion.apache.org Subject: Re: Segfault in Perl bindings when commit touches a large number of files Message-ID: <20150321022519.GA1499@freya.jamessan.com> Mail-Followup-To: James McCoy , Philip Martin , dev@subversion.apache.org References: <20150318032038.GB31550@freya.jamessan.com> <87egomz7h7.fsf@wandisco.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Kj7319i9nmIyA2yE" Content-Disposition: inline In-Reply-To: <87egomz7h7.fsf@wandisco.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Virus-Checked: Checked by ClamAV on apache.org --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 18, 2015 at 02:49:08PM +0000, Philip Martin wrote: > I also see that. Given that Perl has realloc'd some memory I suppose > it might be a reference counting bug in Subversion's XS code. >=20 > Or perhaps the bug might be this code in svn_types.swg: >=20 > %typemap(argout) unsigned char *result_digest { > /* FIXME: This code is clearly buggy. The return value of sv_newmortal() > is immediately overwritten by the return value > of svn_swig_pl_from_md5(). */ > ST(argvi) =3D sv_newmortal(); > ST(argvi++) =3D svn_swig_pl_from_md5($1); > } > #endif Indeed. Reading through some Perl documentation, the original commit, and svn_swig_pl_from_md5, I don't see why the svn_newmortal() call is there. svn_swig_pl_from_md5 already makes its return value mortal, so this is just allocating and overwriting a new SV*. Removing this resolves the crash and reduces the amount of (de)allocations. Cheers, --=20 James GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy --Kj7319i9nmIyA2yE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQJ8BAEBCgBmBQJVDNaIXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ5MUJGQkY0RDY5NTZCRDVERjdCNzJEMjNE RkU2OTFBRTMzMUJBM0RCAAoJEN/mka4zG6Pbt5MP/jVqFDDNXlsdtgg+gkjbhsmj Kkn9KjwZxBVnl8G+pjqoVaJJro0rWKzF1OJ4Cm5XMz79YFtwhLtdTLVH/yNbbHVz P+jcpasIqvbJnII3Wr/l0U+eg4UHKGoitSMqSZkoY8p/TamfNz0zmx5SZLL1Ovj6 C6L0ork3jYNvYOf7jOKWsFNmcfnDtsOJpzFdrUlaK4W8Bi8oU4u9pdNFEkGZl9D4 EApdxMOZYa83jQktjHOzTqPxaQ8XozS9t85ZuWA4dnlkWtTyo1zlqEarf6DaVGuo sQ3/ufzrwKL1Yd5Qtrscn9OeJlcLKs0AFqPEo3ZNO8u+c0e3zTSwc96/47cot2sk EznCa+tP54lC12oLHOvOnLFeUywUoIYw4ho9jgYDO749824SOvHNdRxLJUER7s+b CM5J77Fyv9mlBMpdlRGmdoOsxwV9E2LrGrihqQd1asDmBXWyybDfRUnEDP8vXDXS Vx8pc90ScOXqiibOq39MsBuNNpTjhTmWCeWv5pQn76olQ9a9x7OHN5j+qIxcpEge +s1FFpf2PergNbEdpZQsZFMoo7njNU5P+Cd2Bxg5PpIOEHlp5E4+j+HpKASXSccG HB+QGGodi8I7P65yugScgiDnKV8LIA65tb3cW/q3bD8YGNVWWIO98pEIjtBSf53S PPbB52b5vCfvI91mEMVZ =xVGe -----END PGP SIGNATURE----- --Kj7319i9nmIyA2yE--