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 B7F2B10248 for ; Thu, 12 Feb 2015 17:33:48 +0000 (UTC) Received: (qmail 21866 invoked by uid 500); 12 Feb 2015 17:33:48 -0000 Delivered-To: apmail-subversion-dev-archive@subversion.apache.org Received: (qmail 21811 invoked by uid 500); 12 Feb 2015 17:33:48 -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 21801 invoked by uid 99); 12 Feb 2015 17:33:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Feb 2015 17:33:48 +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 (nike.apache.org: domain of bert@qqmail.nl designates 209.85.212.179 as permitted sender) Received: from [209.85.212.179] (HELO mail-wi0-f179.google.com) (209.85.212.179) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Feb 2015 17:33:22 +0000 Received: by mail-wi0-f179.google.com with SMTP id hi2so6156245wib.0 for ; Thu, 12 Feb 2015 09:31:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qqmail.nl; s=google; h=from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-type:content-transfer-encoding:thread-index :content-language; bh=D5UMTLCJlafwGuvjhL9trSZ5IfUKbtpDmDjr3331CM8=; b=a/skw2dhJrbaJQdqSnxOJiJAB8C7wTt8SXTSt83kFvk882M8eZYz4beAH+wMC6mahX PHkypH4ig/NAK9jahZTq8KRUl/cjptNhBpgb8OOBoiSzCMwB8/8FDL/InNNPobTm+YVi tustam20wuxXZCGbUhPJyWhSaiqhjDoSpcgHA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:references:in-reply-to:subject:date :message-id:mime-version:content-type:content-transfer-encoding :thread-index:content-language; bh=D5UMTLCJlafwGuvjhL9trSZ5IfUKbtpDmDjr3331CM8=; b=TYn3QxvBWfqEq68ZBBA/AhqgF6qV/qOgPkr5UTx0+knQxkwaVcGoSRHXxgu0aKFa2U S1vF3mQyqtUoGZvZp8PePy2YfJ7qOqwbDsUGh8179NQ4E59cLxpoJ376FIBU/Wg85aap ONvaBiYyEjn75beNFz+/m/HJi9z5U7EAt2OPbegAZgtt7sEV8xUhCNE6gpCcJUm+OS4B LGVWYKt5bKsC6pEJ0QnRUIb+K8XeJ91bL51gUbQ7T5GROaqZOoPJ32TbAzgB5geqe2ir gTBzkIlcVR3Wz/D0SAhzU71F8nRb08u/IgZYE/tu9hZ20yXqbXnmt6E8jcY54IE38tIV Gqxg== X-Gm-Message-State: ALoCoQlw46TjQv/n3m02CoA0k3JXUh7ijlZeQgnCLVaiX2PhbwR9AuCYffEh6Ze17/OiB1iRw4+S X-Received: by 10.194.110.137 with SMTP id ia9mr9884799wjb.153.1423762311110; Thu, 12 Feb 2015 09:31:51 -0800 (PST) Received: from i72600 ([2001:610:66e:0:a1fe:7b28:1850:b511]) by mx.google.com with ESMTPSA id 18sm6507133wjr.46.2015.02.12.09.31.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Feb 2015 09:31:50 -0800 (PST) From: "Bert Huijben" To: "'Ivan Zhakov'" , "'Subversion Development'" Cc: "'Philip Martin'" References: <20150211174807.615BDAC006C@hades.apache.org> In-Reply-To: Subject: RE: svn commit: r1659013 - /subversion/trunk/subversion/libsvn_subr/dso.c Date: Thu, 12 Feb 2015 18:31:44 +0100 Message-ID: <023d01d046e9$c5f582b0$51e08810$@qqmail.nl> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQLGaxgUKJyQGwWm9wTRu/jvgsbRtgIdxyacmvAO0RA= Content-Language: nl X-Virus-Checked: Checked by ClamAV on apache.org > -----Original Message----- > From: Ivan Zhakov [mailto:ivan@visualsvn.com] > Sent: donderdag 12 februari 2015 16:59 > To: Subversion Development > Cc: Philip Martin > Subject: Re: svn commit: r1659013 - > /subversion/trunk/subversion/libsvn_subr/dso.c >=20 > On 11 February 2015 at 20:48, wrote: > > Author: philip > > Date: Wed Feb 11 17:48:06 2015 > > New Revision: 1659013 > > > > URL: http://svn.apache.org/r1659013 > > Log: > > Wrap svn_dso_initialize2 call with svn_atomic__init_once, this > > fixes a crash in the DSO hash code when running the C tests in > > parallel. > > > > * subversion/libsvn_subr/dso.c > > (atomic_init_func): New. > > (svn_dso_load): Use svn_atomic__init_once. > > > > Modified: > > subversion/trunk/subversion/libsvn_subr/dso.c > > > > Modified: subversion/trunk/subversion/libsvn_subr/dso.c > > URL: > = http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/dso.= c?re > v=3D1659013&r1=3D1659012&r2=3D1659013&view=3Ddiff > > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- subversion/trunk/subversion/libsvn_subr/dso.c (original) > > +++ subversion/trunk/subversion/libsvn_subr/dso.c Wed Feb 11 = 17:48:06 2015 > > @@ -28,6 +28,7 @@ > > #include "svn_private_config.h" > > > > #include "private/svn_mutex.h" > > +#include "private/svn_atomic.h" > > > > /* A mutex to protect our global pool and cache. */ > > static svn_mutex__t *dso_mutex =3D NULL; > > @@ -41,6 +42,8 @@ static apr_hash_t *dso_cache; > > /* Just an arbitrary location in memory... */ > > static int not_there_sentinel; > > > > +static volatile svn_atomic_t atomic_init_status =3D 0; > > + > > /* A specific value we store in the dso_cache to indicate that the > > library wasn't found. This keeps us from allocating extra = memory > > from dso_pool when trying to find libraries we already know = aren't > > @@ -61,6 +64,14 @@ svn_dso_initialize2(void) > > return SVN_NO_ERROR; > > } > > > > +static svn_error_t * > > +atomic_init_func(void *baton, > > + apr_pool_t *pool) > > +{ > > + SVN_ERR(svn_dso_initialize2()); > > + return SVN_NO_ERROR; > > +} > > + > > #if APR_HAS_DSO > > static svn_error_t * > > svn_dso_load_internal(apr_dso_handle_t **dso, const char *fname) > > @@ -107,8 +118,8 @@ svn_dso_load_internal(apr_dso_handle_t * > > svn_error_t * > > svn_dso_load(apr_dso_handle_t **dso, const char *fname) > > { > > - if (! dso_pool) > > - SVN_ERR(svn_dso_initialize2()); > > + SVN_ERR(svn_atomic__init_once(&atomic_init_status, = atomic_init_func, > > + NULL, NULL)); > > > Philip, >=20 > The fix itself makes sense, but I agree with Evgeny that long-term fix > should be add call to svn_dso_initialize2() in the test suite like we > do in all application and mod_dav_svn. +1 Asked the same question yesterday (on irc). > Also current fix doesn't protect from svn_dso_initialize2() executing > concurrently if one thread call svn_dso_initialize2() directly, while > other thread will call it indirectly through svn_dso_load(). >=20 > Why you didn't make svn_atomic__init_once() internal implementation > details of svn_dso_initialize2()? +1 Good suggestions Bert