Return-Path: X-Original-To: apmail-stdcxx-dev-archive@www.apache.org Delivered-To: apmail-stdcxx-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 E215FD3BD for ; Wed, 26 Sep 2012 00:09:01 +0000 (UTC) Received: (qmail 86787 invoked by uid 500); 26 Sep 2012 00:09:01 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 86706 invoked by uid 500); 26 Sep 2012 00:09:01 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 86696 invoked by uid 99); 26 Sep 2012 00:09:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Sep 2012 00:09:01 +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 wojciech.meyer@googlemail.com designates 74.125.82.182 as permitted sender) Received: from [74.125.82.182] (HELO mail-we0-f182.google.com) (74.125.82.182) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Sep 2012 00:08:57 +0000 Received: by weyx43 with SMTP id x43so9618wey.41 for ; Tue, 25 Sep 2012 17:08:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version:content-type; bh=8zaCNBUtK0Y+SL3pnTYcs1EWHmbSVZ6ZE8wt+audrHA=; b=d2cXVF6TX/JiNinKfrDBmhqu74aEohBwDBuZwyEvIjf5E9Neno3XvjpQ6xQwaqi8PI yY9vverMlAmIdpj0Sht7uAr2GJhXz1xDGHChYVQCqaEr2t/HY7EPuUX2C286tcA6JNn6 npbSxja6+XOEMXX2jxZFjh0M0PVsHgmu/BUD4f1qoBlDi9eTtxshbHGw7+DpDuhgrMyV 1i6YlZglKog1JoE1QCq34e8LVTfqgunWeVEnKRTUDwPvW21jAREk+Cq9YB4YGgNEPPgz k2XiUVPCRWhvEgFN/uIoBSsqCyx1akmWg1pExEcJCFd8O6dMv2rEJtYPMFk5Nb3k6b6X BYZQ== Received: by 10.217.2.133 with SMTP id p5mr10333348wes.143.1348618115635; Tue, 25 Sep 2012 17:08:35 -0700 (PDT) Received: from spec-desktop.danmey.org (cpc1-cmbg12-0-0-cust201.5-4.cable.virginmedia.com. [86.9.116.202]) by mx.google.com with ESMTPS id cl8sm22645606wib.10.2012.09.25.17.08.34 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 25 Sep 2012 17:08:35 -0700 (PDT) From: Wojciech Meyer To: dev@stdcxx.apache.org Subject: Re: [jira] [Closed] (STDCXX-1056) std::moneypunct and std::numpunct implementations are not thread-safe References: <328177502.125959.1348617367665.JavaMail.jiratomcat@arcas> <506246D5.10602@hates.ms> Date: Wed, 26 Sep 2012 01:08:51 +0100 In-Reply-To: <506246D5.10602@hates.ms> (Liviu Nicoara's message of "Tue, 25 Sep 2012 20:05:41 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Virus-Checked: Checked by ClamAV on apache.org Hi guys, I think the consensus about this bug is that everybody wants to fix it. Stefan has a patch but I got completely lost what is the exact reason of not applying it. It would be a shame to stop at this point. Liviu Nicoara writes: > On 9/25/12 7:56 PM, Stefan Teleman (JIRA) wrote: >> >> [ https://issues.apache.org/jira/browse/STDCXX-1056?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] > > Stefan, > > I don't think it's ok to close this bug. The race conditions are there > and we have not come to a completely satisfactory conclusion on how to > deal with them, or even if we should deal with them. Whichever it is > we gotta keep this discussion open. I sure hope you want to be a part > of it. > > FWIW, I have spent quite some time looking at your proposed patch and > I am going to reopen the incident. If I can. > > Liviu > >> >> Stefan Teleman closed STDCXX-1056. >> ---------------------------------- >> >> Resolution: Won't Fix >> >> Bug will not be fixed. Upstream refuses to acknowledge the existence of the bug in spite of objective evidence to the contrary. >> >>> std::moneypunct and std::numpunct implementations are not thread-safe >>> --------------------------------------------------------------------- >>> >>> Key: STDCXX-1056 >>> URL: https://issues.apache.org/jira/browse/STDCXX-1056 >>> Project: C++ Standard Library >>> Issue Type: Bug >>> Components: 22. Localization >>> Affects Versions: 4.2.1, 4.2.x, 4.3.x, 5.0.0 >>> Environment: Solaris 10 and 11, RedHat and OpenSuSE Linux, Sun C++ Compilers 12.1, 12.2, 12.3 >>> Issue is independent of platform and/or compiler. >>> Reporter: Stefan Teleman >>> Labels: thread-safety >>> Fix For: 4.2.x, 4.3.x, 5.0.0 >>> >>> Attachments: 22.locale.numpunct.mt.out, facet.cpp.diff, locale_body.cpp.diff, punct.cpp.diff, runtests-linux32-all.out, runtests-linux64-all.out, runtests.out, STDCXX-1056-additional-timings.tgz, stdcxx-1056.patch, stdcxx-1056-timings.tgz, stdcxx-4.2.x-numpunct-perfect-forwarding.patch, stdcxx-4.3.x-numpunct-perfect-forwarding.patch >>> >>> >>> several member functions in std::moneypunct<> and std::numpunct<> return >>> a std::string by value (as required by the Standard). The implication of return-by-value >>> being that the caller "owns" the returned object. >>> In the stdcxx implementation, the std::basic_string copy constructor uses a shared >>> underlying buffer implementation. This shared buffer creates the first problem for >>> these classes: although the std::string object returned by value *appears* to be owned >>> by the caller, it is, in fact, not. >>> In a mult-threaded environment, this underlying shared buffer can be subsequently modified by a different thread than the one who made the initial call. Furthermore, two or more different threads can access the same shared buffer at the same time, and modify it, resulting in undefined run-time behavior. >>> The cure for this defect has two parts: >>> 1. the member functions in question must truly return a copy by avoiding a call to the copy constructor, and using a constructor which creates a deep copy of the std::string. >>> 2. access to these member functions must be serialized, in order to guarantee atomicity >>> of the creation of the std::string being returned by value. >>> Patch for 4.2.1 to follow. >> >> -- >> This message is automatically generated by JIRA. >> If you think it was sent incorrectly, please contact your JIRA administrators >> For more information on JIRA, see: http://www.atlassian.com/software/jira >> > -- Wojciech Meyer http://danmey.org