From owner-freebsd-questions@FreeBSD.ORG Fri Nov 6 16:52:27 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE8491065672 for ; Fri, 6 Nov 2009 16:52:27 +0000 (UTC) (envelope-from psteele@maxiscale.com) Received: from server505.appriver.com (server505b.appriver.com [98.129.35.5]) by mx1.freebsd.org (Postfix) with ESMTP id 803DA8FC14 for ; Fri, 6 Nov 2009 16:52:27 +0000 (UTC) X-Policy: GLOBAL - maxiscale.com X-Primary: psteele@maxiscale.com X-Note: This Email was scanned by AppRiver SecureTide X-ALLOW: psteele@maxiscale.com ALLOWED X-Virus-Scan: V- X-Note: Spam Tests Failed: X-Country-Path: UNITED STATES->UNITED STATES->UNITED STATES X-Note-Sending-IP: 98.129.23.15 X-Note-Reverse-DNS: ht02.exg5.exghost.com X-Note-WHTLIST: psteele@maxiscale.com X-Note: User Rule Hits: X-Note: Global Rule Hits: 112 113 114 115 119 120 131 217 X-Note: Mail Class: ALLOWEDSENDER X-Note: Headers Injected Received: from [98.129.23.15] (HELO ht02.exg5.exghost.com) by server505.appriver.com (CommuniGate Pro SMTP 5.2.14) with ESMTPS id 13076191 for freebsd-questions@freebsd.org; Fri, 06 Nov 2009 10:52:24 -0600 Received: from mbx03.exg5.exghost.com ([169.254.1.164]) by ht02.exg5.exghost.com ([98.129.23.15]) with mapi; Fri, 6 Nov 2009 10:52:26 -0600 From: Peter Steele To: "freebsd-questions@freebsd.org" Date: Fri, 6 Nov 2009 10:52:24 -0600 Thread-Topic: system() call causes core dump Thread-Index: Acpe994NrLDsOd1vSWaloREXvgrF7QABCaBg Message-ID: <7B9397B189EB6E46A5EE7B4C8A4BB7CB3394EDDF@MBX03.exg5.exghost.com> References: <7B9397B189EB6E46A5EE7B4C8A4BB7CB327D117F@MBX03.exg5.exghost.com> <4AEC5E02.8040705@FreeBSD.org> <7B9397B189EB6E46A5EE7B4C8A4BB7CB327D11A9@MBX03.exg5.exghost.com> <200911040149.48701.mel.flynn+fbsd.questions@mailing.thruhere.net> <7B9397B189EB6E46A5EE7B4C8A4BB7CB3394ED41@MBX03.exg5.exghost.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: RE: system() call causes core dump X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2009 16:52:27 -0000 >I am following this thread since i find it interesting ( playing around wi= th popen & threads at times ). > >I am still trying to understand what Kris said. He says it is not safe to = fork from a multithread proces. And he suggests using execve. > >You stacktrace btw is consistent with what Kris says: "and if that thread = tries to acquire a lock or other formerly-shared resource it may deadlock o= r crash, because the child process is >no longer accessing the same memory location as the threads in the parent = process". -> that's probably the spinlock in malloc. This is why we switched to vsys/vfork, assuming it would effectively do the= same thing as execve. Perhaps not not. I can give it a try. I am still cur= ious though why only this one particular system call is causing a crash. We= have many calls running in other threads and none have ever caused a probl= em. They all do the same thing, run a command and save the output in a file= , and then we process the output. The only thing different is the command w= e run in this case-fstat.