From owner-freebsd-threads@freebsd.org Tue Sep 1 17:44:31 2015 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 045EE9C8BD0 for ; Tue, 1 Sep 2015 17:44:31 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E23301BD2 for ; Tue, 1 Sep 2015 17:44:30 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id t81HiUuk038759 for ; Tue, 1 Sep 2015 17:44:30 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-threads@FreeBSD.org Subject: [Bug 202636] race in lib/libc/nls/msgcat.c Date: Tue, 01 Sep 2015 17:44:31 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: patch X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: linimon@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-threads@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Sep 2015 17:44:31 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202636 Mark Linimon changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch -- You are receiving this mail because: You are the assignee for the bug. From owner-freebsd-threads@freebsd.org Thu Sep 3 01:14:44 2015 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F3D49C9633; Thu, 3 Sep 2015 01:14:44 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) Received: from alogt.com (alogt.com [69.36.191.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1097B90A; Thu, 3 Sep 2015 01:14:43 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alogt.com; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Subject:Cc:To:From:Date; bh=sJcO9n364yQ2nEU0xg8NR71+d42zcxZT1JiyS/0Xvno=; b=c2CGdHjpEoDqbXtcb4/a5Jt6yQp3c00EXtg3Lx10kUGptQzPcQGF77Cv89BMra6N9ogRL1ObJ/RVAe5hGCNu2v3nuy/OOyCD5oYLdMbLeYvzhWkZfHQS3q9vwpgR/xweiVJtO11DkQEME/qKkQmOq4qnzXcUpK7VBh2B80dWQAM=; Received: from [114.124.38.120] (port=27026 helo=X220.alogt.com) by sl-508-2.slc.westdc.net with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.85) (envelope-from ) id 1ZXHxV-003UgK-Qt; Wed, 02 Sep 2015 18:00:54 -0600 Date: Thu, 3 Sep 2015 08:00:47 +0800 From: Erich Dollansky To: freebsd-threads@freebsd.org Cc: FreeBSD stable Subject: pthread_cancel / sleep change in behaviour Message-ID: <20150903080047.16be939e@X220.alogt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sl-508-2.slc.westdc.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - alogt.com X-Get-Message-Sender-Via: sl-508-2.slc.westdc.net: authenticated_id: erichsfreebsdlist@alogt.com X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Sep 2015 01:14:44 -0000 Hi, I noticed a change in behaviour when calling pthread_cancel for a thread which is sleeping using i.e. sleep (). How I understand pthread_cancel, it should cancel the thread and call the clean up handler soon after its return. Important is that the cancelled thread waited on a cancellation point. When I started testing our application under error conditions, I found problems I could not explain. As the application's target is a Raspberry, some tests have been done on a 10.1 on the Raspberry and some on a amd64 machine running 10.2 STABLE. The behaviour on the Raspberry was as expected but not on the amd64. The situation is now that there are always pairs of threads. One thread does the work, the other thread just does a sleep() and cancels the worker thread at the end. But, when the worker thread finishes its work normally, it cancels the sleeping thread and then returns. After some time of testing I found out that pthread_cancel calls the clean up handler of the sleeping thread only after sleep()'s return when running on 10.2 STABLE on amd64 but calls the clean up handler soon after cancellation on 10.1 on the Raspberry. Is this change of behaviour a feature or a bug? Erich From owner-freebsd-threads@freebsd.org Thu Sep 3 08:19:59 2015 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CDBE9C929D; Thu, 3 Sep 2015 08:19:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DAB59159D; Thu, 3 Sep 2015 08:19:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t838JmPa024872 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 3 Sep 2015 11:19:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t838JmPa024872 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t838Jlx0024871; Thu, 3 Sep 2015 11:19:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 3 Sep 2015 11:19:47 +0300 From: Konstantin Belousov To: Erich Dollansky Cc: freebsd-threads@freebsd.org, FreeBSD stable Subject: Re: pthread_cancel / sleep change in behaviour Message-ID: <20150903081947.GB2072@kib.kiev.ua> References: <20150903080047.16be939e@X220.alogt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150903080047.16be939e@X220.alogt.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Sep 2015 08:19:59 -0000 On Thu, Sep 03, 2015 at 08:00:47AM +0800, Erich Dollansky wrote: > Hi, > > I noticed a change in behaviour when calling pthread_cancel for a > thread which is sleeping using i.e. sleep (). > > How I understand pthread_cancel, it should cancel the thread and call > the clean up handler soon after its return. Important is that the > cancelled thread waited on a cancellation point. > > When I started testing our application under error conditions, I found > problems I could not explain. As the application's target is a > Raspberry, some tests have been done on a 10.1 on the Raspberry and > some on a amd64 machine running 10.2 STABLE. The behaviour on the > Raspberry was as expected but not on the amd64. > > The situation is now that there are always pairs of threads. One thread > does the work, the other thread just does a sleep() and cancels the > worker thread at the end. But, when the worker thread finishes its work > normally, it cancels the sleeping thread and then returns. > > After some time of testing I found out that pthread_cancel calls the > clean up handler of the sleeping thread only after sleep()'s return > when running on 10.2 STABLE on amd64 but calls the clean up handler > soon after cancellation on 10.1 on the Raspberry. > > Is this change of behaviour a feature or a bug? Provide a minimal example demonstrating the issue. From owner-freebsd-threads@freebsd.org Thu Sep 3 10:34:02 2015 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15A039C842F; Thu, 3 Sep 2015 10:34:02 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) Received: from alogt.com (alogt.com [69.36.191.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E2499194C; Thu, 3 Sep 2015 10:34:01 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alogt.com; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=Q0XkQq+Pir6+ftTFr7cm84q7GQQX9ssRNGvpQI5E2GA=; b=ZvQxTuprQJWIaPOLOCtKsR+qwPhxALrQeriX//BtnWXS/6EkSCviBKfda1VjoKkTwP+FUxSxBWwqspPuefQQoEkj9TuJfXsBptKkBCWOTTZwfiMNndAwHECgw371wN6AjwhW+eHjXDN51kv/s4v31nXwfrxOZVH2XSyJ8iwkc3E=; Received: from [114.124.24.124] (port=21167 helo=X220.alogt.com) by sl-508-2.slc.westdc.net with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.85) (envelope-from ) id 1ZXRqC-001MZu-7Y; Thu, 03 Sep 2015 04:34:00 -0600 Date: Thu, 3 Sep 2015 18:33:53 +0800 From: Erich Dollansky To: Konstantin Belousov Cc: FreeBSD stable , freebsd-threads@freebsd.org Subject: Re: pthread_cancel / sleep change in behaviour Message-ID: <20150903183353.2633a38b@X220.alogt.com> In-Reply-To: <20150903081947.GB2072@kib.kiev.ua> References: <20150903080047.16be939e@X220.alogt.com> <20150903081947.GB2072@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sl-508-2.slc.westdc.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - alogt.com X-Get-Message-Sender-Via: sl-508-2.slc.westdc.net: authenticated_id: erichsfreebsdlist@alogt.com X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Sep 2015 10:34:02 -0000 Hi, On Thu, 3 Sep 2015 11:19:47 +0300 Konstantin Belousov wrote: > On Thu, Sep 03, 2015 at 08:00:47AM +0800, Erich Dollansky wrote: > > > > Is this change of behaviour a feature or a bug? > > Provide a minimal example demonstrating the issue. while preparing the example I found the source of the problem. We have to block all signals for some reason. The handling for signal (SIGTHR, SIG_IGN); seems to have changed. The moment I remove above's line from the code, the program works. There is no difference when the programs runs on machines prior mid November 2014. Thanks for your help. Simplifying the program brought me to the solution. Do you want the example? Erich > _______________________________________________ > freebsd-stable@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to > "freebsd-stable-unsubscribe@freebsd.org" From owner-freebsd-threads@freebsd.org Thu Sep 3 10:44:00 2015 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7B389C8A18; Thu, 3 Sep 2015 10:44:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21E2C1DAC; Thu, 3 Sep 2015 10:43:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t83AhpGx065948 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 3 Sep 2015 13:43:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t83AhpGx065948 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t83AhpNY065947; Thu, 3 Sep 2015 13:43:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 3 Sep 2015 13:43:51 +0300 From: Konstantin Belousov To: Erich Dollansky Cc: FreeBSD stable , freebsd-threads@freebsd.org Subject: Re: pthread_cancel / sleep change in behaviour Message-ID: <20150903104351.GE2072@kib.kiev.ua> References: <20150903080047.16be939e@X220.alogt.com> <20150903081947.GB2072@kib.kiev.ua> <20150903183353.2633a38b@X220.alogt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150903183353.2633a38b@X220.alogt.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Sep 2015 10:44:00 -0000 On Thu, Sep 03, 2015 at 06:33:53PM +0800, Erich Dollansky wrote: > Hi, > > On Thu, 3 Sep 2015 11:19:47 +0300 > Konstantin Belousov wrote: > > > On Thu, Sep 03, 2015 at 08:00:47AM +0800, Erich Dollansky wrote: > > > > > > Is this change of behaviour a feature or a bug? > > > > Provide a minimal example demonstrating the issue. > > while preparing the example I found the source of the problem. We have > to block all signals for some reason. The handling for > > signal (SIGTHR, SIG_IGN); > > seems to have changed. The moment I remove above's line from the code, > the program works. There is no difference when the programs runs on > machines prior mid November 2014. > Err, this is a bug, probably both in your program (user code must not twiddle with SIGCANCEL) and in libc. The later, I believe, was fixed in the HEAD r287300, which is not yet merged back to stable/10. The libthr has a protection disallowing user code manipulating SIGCANCEL, but due to the bug in libc signal(3) override the libthr measures. Apply the r287300 to your src/ and try your unchanged program with updated libc. But yes, SIGTHR/SIGCANCEL in the program is bug. > Thanks for your help. Simplifying the program brought me to the > solution. > > Do you want the example? > > Erich > > _______________________________________________ > > freebsd-stable@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/freebsd-stable > > To unsubscribe, send any mail to > > "freebsd-stable-unsubscribe@freebsd.org" From owner-freebsd-threads@freebsd.org Thu Sep 3 11:02:59 2015 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FDCA9C9587; Thu, 3 Sep 2015 11:02:59 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) Received: from alogt.com (alogt.com [69.36.191.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5CF17A4C; Thu, 3 Sep 2015 11:02:59 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alogt.com; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=JMx6ONg0cwRtEh6VLO+jf5GQErquC60j7mUlB+LI6OI=; b=bx7PNYbnyh0kvJbTciIckjKazlXiXebS4HLSZazKc5oDBADqKyDoOgAzwKC4l4O0fca7Z6ScHu5zPYth7OPm3PeAuYgQEcevAlCN3kxzjOJwRwpQAiOqtjkYag3xqDmBil5yiIpyeNEamqJyKowgJ5X1LVKR8ywfYNHBJRHDNQQ=; Received: from [114.124.24.124] (port=64735 helo=X220.alogt.com) by sl-508-2.slc.westdc.net with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.85) (envelope-from ) id 1ZXSIE-001itn-0E; Thu, 03 Sep 2015 05:02:58 -0600 Date: Thu, 3 Sep 2015 19:02:50 +0800 From: Erich Dollansky To: Konstantin Belousov Cc: FreeBSD stable , freebsd-threads@freebsd.org Subject: Re: pthread_cancel / sleep change in behaviour Message-ID: <20150903190250.26273e27@X220.alogt.com> In-Reply-To: <20150903104351.GE2072@kib.kiev.ua> References: <20150903080047.16be939e@X220.alogt.com> <20150903081947.GB2072@kib.kiev.ua> <20150903183353.2633a38b@X220.alogt.com> <20150903104351.GE2072@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sl-508-2.slc.westdc.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - alogt.com X-Get-Message-Sender-Via: sl-508-2.slc.westdc.net: authenticated_id: erichsfreebsdlist@alogt.com X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Sep 2015 11:02:59 -0000 Hi, On Thu, 3 Sep 2015 13:43:51 +0300 Konstantin Belousov wrote: > On Thu, Sep 03, 2015 at 06:33:53PM +0800, Erich Dollansky wrote: > > On Thu, 3 Sep 2015 11:19:47 +0300 > > Konstantin Belousov wrote: > > > > > On Thu, Sep 03, 2015 at 08:00:47AM +0800, Erich Dollansky wrote: > > > > > > > > Is this change of behaviour a feature or a bug? > > > > > > Provide a minimal example demonstrating the issue. > > > > while preparing the example I found the source of the problem. We > > have to block all signals for some reason. The handling for > > > > signal (SIGTHR, SIG_IGN); > > > > seems to have changed. The moment I remove above's line from the > > code, the program works. There is no difference when the programs > > runs on machines prior mid November 2014. > > > Err, this is a bug, probably both in your program (user code must not > twiddle with SIGCANCEL) and in libc. The later, I believe, was fixed I did not know of this. I simply blocked all. As it worked when I tested it those days, I forgot about it. > in the HEAD r287300, which is not yet merged back to stable/10. The > libthr has a protection disallowing user code manipulating SIGCANCEL, > but due to the bug in libc signal(3) override the libthr measures. > > Apply the r287300 to your src/ and try your unchanged program with > updated libc. But yes, SIGTHR/SIGCANCEL in the program is bug. > I am just updating another machine. It might be already tomorrow when I will come back to you. Erich From owner-freebsd-threads@freebsd.org Fri Sep 4 00:37:52 2015 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC1339C904B; Fri, 4 Sep 2015 00:37:52 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) Received: from alogt.com (alogt.com [69.36.191.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAC591E2E; Fri, 4 Sep 2015 00:37:52 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alogt.com; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=tDp9bHNdEY+aLIkEEsQNqlFkKEjOCXcXRli/us/F4pQ=; b=V+JwrWWX/EBDNIfhSwSbBenistwZWBzbmDQGFX4+h1BklKhbcIyECWEyd6ZGa3nMzEL6CdzAHL3ME4TiOTciMhG462SHBE7A5cG4l+suWa/5wCnpHXofLAiLXVWr0UTnbDX5VyQwGlgFDIgPDnJNuSUn+jAgg8U7v1v+6+3Wd44=; Received: from [114.121.152.180] (port=20791 helo=X220.alogt.com) by sl-508-2.slc.westdc.net with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.85) (envelope-from ) id 1ZXf0j-003gn2-Ez; Thu, 03 Sep 2015 18:37:46 -0600 Date: Fri, 4 Sep 2015 08:37:40 +0800 From: Erich Dollansky To: Konstantin Belousov Cc: FreeBSD stable , freebsd-threads@freebsd.org Subject: Re: pthread_cancel / sleep change in behaviour Message-ID: <20150904083740.5f3e49aa@X220.alogt.com> In-Reply-To: <20150903104351.GE2072@kib.kiev.ua> References: <20150903080047.16be939e@X220.alogt.com> <20150903081947.GB2072@kib.kiev.ua> <20150903183353.2633a38b@X220.alogt.com> <20150903104351.GE2072@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sl-508-2.slc.westdc.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - alogt.com X-Get-Message-Sender-Via: sl-508-2.slc.westdc.net: authenticated_id: erichsfreebsdlist@alogt.com X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Sep 2015 00:37:52 -0000 Hi, On Thu, 3 Sep 2015 13:43:51 +0300 Konstantin Belousov wrote: > On Thu, Sep 03, 2015 at 06:33:53PM +0800, Erich Dollansky wrote: > > On Thu, 3 Sep 2015 11:19:47 +0300 > > Konstantin Belousov wrote: > > > On Thu, Sep 03, 2015 at 08:00:47AM +0800, Erich Dollansky wrote: > > > > Is this change of behaviour a feature or a bug? > > > Provide a minimal example demonstrating the issue. > > while preparing the example I found the source of the problem. We > > have to block all signals for some reason. The handling for > > > > signal (SIGTHR, SIG_IGN); > > > > seems to have changed. The moment I remove above's line from the > > code, the program works. There is no difference when the programs > > runs on machines prior mid November 2014. > > > Err, this is a bug, probably both in your program (user code must not > twiddle with SIGCANCEL) and in libc. The later, I believe, was fixed I just ran the same binary on: FreeBSD B85M-HD3-0.alogt.com 11.0-CURRENT FreeBSD 11.0-CURRENT #5 r287425: Thu Sep 3 21:44:16 WITA 2015 erich@B85M-HD3-0.alogt.com:/usr/obj/usr/src/sys/B85M-HD3 amd64 and it works there. So, it is just a matter of time until the fix finds its way back to 10? Of course, I do not ignore the signal now in the application anymore. The application then works as expected on 10.2 STABLE. Thanks for your work and also thanks for your help. Erich From owner-freebsd-threads@freebsd.org Fri Sep 4 08:19:10 2015 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05A219C9997; Fri, 4 Sep 2015 08:19:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73044A61; Fri, 4 Sep 2015 08:19:09 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t848IwGp083857 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 4 Sep 2015 11:18:58 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t848IwGp083857 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t848Iwx9083856; Fri, 4 Sep 2015 11:18:58 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 4 Sep 2015 11:18:57 +0300 From: Konstantin Belousov To: Erich Dollansky Cc: FreeBSD stable , freebsd-threads@freebsd.org Subject: Re: pthread_cancel / sleep change in behaviour Message-ID: <20150904081857.GF2072@kib.kiev.ua> References: <20150903080047.16be939e@X220.alogt.com> <20150903081947.GB2072@kib.kiev.ua> <20150903183353.2633a38b@X220.alogt.com> <20150903104351.GE2072@kib.kiev.ua> <20150904083740.5f3e49aa@X220.alogt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150904083740.5f3e49aa@X220.alogt.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Sep 2015 08:19:10 -0000 On Fri, Sep 04, 2015 at 08:37:40AM +0800, Erich Dollansky wrote: > Hi, > > On Thu, 3 Sep 2015 13:43:51 +0300 > Konstantin Belousov wrote: > > On Thu, Sep 03, 2015 at 06:33:53PM +0800, Erich Dollansky wrote: > > > On Thu, 3 Sep 2015 11:19:47 +0300 > > > Konstantin Belousov wrote: > > > > On Thu, Sep 03, 2015 at 08:00:47AM +0800, Erich Dollansky wrote: > > > > > Is this change of behaviour a feature or a bug? > > > > Provide a minimal example demonstrating the issue. > > > while preparing the example I found the source of the problem. We > > > have to block all signals for some reason. The handling for > > > > > > signal (SIGTHR, SIG_IGN); > > > > > > seems to have changed. The moment I remove above's line from the > > > code, the program works. There is no difference when the programs > > > runs on machines prior mid November 2014. > > > > > Err, this is a bug, probably both in your program (user code must not > > twiddle with SIGCANCEL) and in libc. The later, I believe, was fixed > > I just ran the same binary on: > > FreeBSD B85M-HD3-0.alogt.com 11.0-CURRENT FreeBSD 11.0-CURRENT #5 > r287425: Thu Sep 3 21:44:16 WITA 2015 > erich@B85M-HD3-0.alogt.com:/usr/obj/usr/src/sys/B85M-HD3 amd64 > > and it works there. > > So, it is just a matter of time until the fix finds its way back to 10? Yes, should be several days timeframe. > > Of course, I do not ignore the signal now in the application anymore. > The application then works as expected on 10.2 STABLE. Well, the consequence of the bug, which affected you, is that it was allowed for the applications to ignore SIGCANCEL. With the bug fixed, the signal(SIGCANCEL, anything) becomes nop. From owner-freebsd-threads@freebsd.org Fri Sep 4 08:35:32 2015 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B39E09CA147; Fri, 4 Sep 2015 08:35:32 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) Received: from alogt.com (alogt.com [69.36.191.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F8FD11D8; Fri, 4 Sep 2015 08:35:32 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alogt.com; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=KCPPCzpnf4j6rOjvMEiF+CvVpVv5F6KG0UAnaQJ6wRk=; b=ge3gLGTwJtUj/c2YzSpTQQHuKV1Sm1AMU5Pas7w+12JQMVG9Hr86dqedn8Y2cmT7TH1VyxjDDBU5dT3PXNO8LnhkEGF4CneSGoiQ0NAXAvlmYm+07qDy71Sn+4hPk8FsPkQuu37x7YbAlPJmF+a4LR3Dh7+mN8LGJqvcWCFMa74=; Received: from dynamic-pool-telkomsel-114-124-0-8.telkomsel.net.id ([114.124.0.8]:29478 helo=X220.alogt.com) by sl-508-2.slc.westdc.net with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.85) (envelope-from ) id 1ZXmT4-00429N-Jy; Fri, 04 Sep 2015 02:35:31 -0600 Date: Fri, 4 Sep 2015 16:35:24 +0800 From: Erich Dollansky To: Konstantin Belousov Cc: FreeBSD stable , freebsd-threads@freebsd.org Subject: Re: pthread_cancel / sleep change in behaviour Message-ID: <20150904163524.0b420a90@X220.alogt.com> In-Reply-To: <20150904081857.GF2072@kib.kiev.ua> References: <20150903080047.16be939e@X220.alogt.com> <20150903081947.GB2072@kib.kiev.ua> <20150903183353.2633a38b@X220.alogt.com> <20150903104351.GE2072@kib.kiev.ua> <20150904083740.5f3e49aa@X220.alogt.com> <20150904081857.GF2072@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sl-508-2.slc.westdc.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - alogt.com X-Get-Message-Sender-Via: sl-508-2.slc.westdc.net: authenticated_id: erichsfreebsdlist@alogt.com X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Sep 2015 08:35:32 -0000 Hi,. On Fri, 4 Sep 2015 11:18:57 +0300 Konstantin Belousov wrote: > On Fri, Sep 04, 2015 at 08:37:40AM +0800, Erich Dollansky wrote: > > On Thu, 3 Sep 2015 13:43:51 +0300 > > > > and it works there. > > > > So, it is just a matter of time until the fix finds its way back to > > 10? > Yes, should be several days timeframe. this sounds perfect. > > > > > Of course, I do not ignore the signal now in the application > > anymore. The application then works as expected on 10.2 STABLE. > Well, the consequence of the bug, which affected you, is that it was > allowed for the applications to ignore SIGCANCEL. With the bug fixed, > the signal(SIGCANCEL, anything) becomes nop. Was it just me being blind or is the documentation on this a bit limited? Erich From owner-freebsd-threads@freebsd.org Fri Sep 4 12:30:48 2015 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB4259C9DD8; Fri, 4 Sep 2015 12:30:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 536C7961; Fri, 4 Sep 2015 12:30:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t84CUac0064199 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 4 Sep 2015 15:30:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t84CUac0064199 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t84CUaaj064134; Fri, 4 Sep 2015 15:30:36 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 4 Sep 2015 15:30:36 +0300 From: Konstantin Belousov To: Erich Dollansky Cc: FreeBSD stable , freebsd-threads@freebsd.org Subject: Re: pthread_cancel / sleep change in behaviour Message-ID: <20150904123036.GH2072@kib.kiev.ua> References: <20150903080047.16be939e@X220.alogt.com> <20150903081947.GB2072@kib.kiev.ua> <20150903183353.2633a38b@X220.alogt.com> <20150903104351.GE2072@kib.kiev.ua> <20150904083740.5f3e49aa@X220.alogt.com> <20150904081857.GF2072@kib.kiev.ua> <20150904163524.0b420a90@X220.alogt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150904163524.0b420a90@X220.alogt.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Sep 2015 12:30:49 -0000 On Fri, Sep 04, 2015 at 04:35:24PM +0800, Erich Dollansky wrote: > Hi,. > > On Fri, 4 Sep 2015 11:18:57 +0300 > Konstantin Belousov wrote: > > > On Fri, Sep 04, 2015 at 08:37:40AM +0800, Erich Dollansky wrote: > > > On Thu, 3 Sep 2015 13:43:51 +0300 > > > > > > and it works there. > > > > > > So, it is just a matter of time until the fix finds its way back to > > > 10? > > Yes, should be several days timeframe. > > this sounds perfect. > > > > > > > > Of course, I do not ignore the signal now in the application > > > anymore. The application then works as expected on 10.2 STABLE. > > Well, the consequence of the bug, which affected you, is that it was > > allowed for the applications to ignore SIGCANCEL. With the bug fixed, > > the signal(SIGCANCEL, anything) becomes nop. > > Was it just me being blind or is the documentation on this a bit > limited? Documentation on what ? SIGCANCEL is non-standard signal, it is not documented because this is internal facility for the threading library. Fiddling with anything without understanding the functionality is not the best idea.