From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756137AbZERHGm (ORCPT ); Mon, 18 May 2009 03:06:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755643AbZERHGc (ORCPT ); Mon, 18 May 2009 03:06:32 -0400 Received: from yw-out-2324.google.com ([74.125.46.31]:8292 "EHLO yw-out-2324.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751379AbZERHGb convert rfc822-to-8bit (ORCPT ); Mon, 18 May 2009 03:06:31 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=q0W2P4vLEDYpFtL+R6jf5CBdBG1rLiP8rP9qkpx88yx1zzETgtdTsudK0vZu3fUlcW lO0OMyCyVwitDVBTBa75NcAFs+lqdBH0sLymnn6XMSurZiLNuP4AI2lba4JKQdJL1kSs UmP9MMMkEpu3AP6hgmfMlKI/JybLGQdtYMHJc= MIME-Version: 1.0 In-Reply-To: References: Date: Mon, 18 May 2009 12:36:32 +0530 Message-ID: Subject: Re: linux-kernel@vger.kernel.org From: Sudarshan Soma To: Sudarshan Soma , Robert Hancock Cc: linux-kernel@vger.kernel.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It looks like i can't call exit(-1)in signal handlers as its Asynchronous—signal-safe function. As my application wont register any exit handler functions, is this safe to use?? Please suggest if there are better alternatives. On Mon, May 18, 2009 at 11:44 AM, Sudarshan Soma wrote: > --- On Sat, 16/5/09, Robert Hancock wrote: > > > From: Robert Hancock > Subject: Re: patch related to SIGSEGV handling in multiple threads > and hung threads > To: "Sudarshan Soma" > Cc: linux-kernel@vger.kernel.org > Date: Saturday, 16 May, 2009, 6:45 AM > > Sudarshan Soma wrote: > > Hi , > > I have a program which will create multiple threads. One of the thread > > receives SIGSEGV and it prints stacktrace in its handler and calls > > _exit(-1). The call to exit wont terminate all threads in a process > > and hence thread hangs here. This causes resouce leaks and other > > problems. It is seen only on linux 2.4.20. > > > > For printing stacktrace it uses > > __builtin_return_address and __builtin_frame_address > > > > > > The same program works fine on linux 2.6.26 kernel. It will exit the > > whole process when one of its thread dies as above. > > > > > > Please let me know the patch details or any workaround, if any. This > > is a bit urgent, so please let me know for any pointers , if any > > > > Thanks and Best Regards, > > Pavan. > > [Robert] > That doesn't seem surprising, the old LinuxThreads thread > implementation normally used with the 2.4 kernels was pretty poor. > However it would likely be better to re-raise the signal rather than > trying to exit out of the signal handler. > > > [Pavan] > Thanks Robert. > using exit(-1) instead of exit(0) does terminate all the threads in > the process in my sample program. Please suggest if this workaround > is safe for now. > > I would like to kill whole process(and its threads) when one of the > thread gets SIGSEGV signal. Could you please eloborate , how could i > achieve the same by raising SIGSEGV signal again.. > > Best Regards, > Pavan. >