From owner-freebsd-questions@FreeBSD.ORG Fri Nov 6 15:20:02 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 42D64106566B for ; Fri, 6 Nov 2009 15:20:02 +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 08CEC8FC18 for ; Fri, 6 Nov 2009 15:20:01 +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 13064663 for freebsd-questions@freebsd.org; Fri, 06 Nov 2009 09:20:11 -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 09:20:00 -0600 From: Peter Steele To: "freebsd-questions@freebsd.org" Date: Fri, 6 Nov 2009 09:19:57 -0600 Thread-Topic: system() call causes core dump Thread-Index: Acpc6L6MOqfERPeCSHSBWmT93mDKEACCdcwQ Message-ID: <7B9397B189EB6E46A5EE7B4C8A4BB7CB3394ED41@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> In-Reply-To: <200911040149.48701.mel.flynn+fbsd.questions@mailing.thruhere.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 15:20:02 -0000 > Either I'm very lucky, or popen is better suited for this, as I have this= running on various machines, 24/7: ... I could try popen as a next step. What we tried first was to replace our sy= stem calls with a function called vsys() which does exactly the same thing = but uses vfork() underneath instead of fork(). If this problem had been due= to resource conflicts due to the fork() performed by system(), we figured = this would solve the problem. Unfortunately, we are still getting the exact= same core with the identical stack trace. #0 0x0000000801058307 in _spinunlock () from /lib/libthr.so.3 #1 0x00000008011d0afb in _malloc_postfork () from /lib/libc.so.7 #2 0x000000080105c5fb in fork () from /lib/libthr.so.3 #3 0x0000000801191aae in system () from /lib/libc.so.7 #4 0x00000008010553aa in system () from /lib/libthr.so.3 #5 0x000000000040b6f9 in mythread at myapp.c:461 #6 0x0000000801056a88 in pthread_getprio () from /lib/libthr.so.3 I don't know much about the internal implementation of popen but I suspect = that at its core it still likely ends up doing a fork(). Still, it's worth = a try. Curiously, we have several other threads in our application running = in threads that periodically make system calls. For some reason only this c= all to fstat causes a core to occur. Seems that something fishy is going on= here....