From owner-freebsd-dtrace@FreeBSD.ORG Sun Dec 21 23:58:13 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AE2CEA20 for ; Sun, 21 Dec 2014 23:58:13 +0000 (UTC) Received: from mail-ie0-x231.google.com (mail-ie0-x231.google.com [IPv6:2607:f8b0:4001:c03::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 71E27321B for ; Sun, 21 Dec 2014 23:58:13 +0000 (UTC) Received: by mail-ie0-f177.google.com with SMTP id rd18so3483174iec.22 for ; Sun, 21 Dec 2014 15:58:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=T6BKSuiCPXp9FKBF8sMQabnK0dq82eLktrVuf8NVVb0=; b=rauaQuib2EkRJqRLJTrc+hrRtzu1jueg5UYTHZlJDbGT4/izzTGsD+O/crecgqpf5R jKcj7P6wyUiEc/70n0d8hdaMMlAJhS2weqVOSqSNnObdMvzos0GuYiUFs7k1I+ZiElaZ ivX/ryCHlalK1QzZyN5jhSsDY73Zz8CDiqNsOBMFL6JmLYcaFtTueECojfzgW80+s1SE dKZlXhWJcGPrxrVo4Kb4X08OYo4QbvBVHUJEzctTWN8szzYd+Zbp3ob8ebvjHFHkHD2P Mtkh9iAtgB9R/Qb3cTC5N/zC7lh150LOaR4sfRpkkn62iwSByZlxgIb0P61YJocGSYXI knCQ== X-Received: by 10.107.7.142 with SMTP id g14mr17994855ioi.81.1419206292421; Sun, 21 Dec 2014 15:58:12 -0800 (PST) Received: from brule.home (TOROON0812W-LP130-04-1279423115.dsl.bell.ca. [76.66.114.139]) by mx.google.com with ESMTPSA id mv6sm4112722igb.10.2014.12.21.15.58.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Dec 2014 15:58:11 -0800 (PST) Sender: Mark Johnston Date: Sun, 21 Dec 2014 18:58:06 -0500 From: Mark Johnston To: Lacey Powers Subject: Re: elf_begin failed on postgresql 9.4 with dtrace enabled Message-ID: <20141221235806.GA20561@brule.home> References: <54975631.3040106@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54975631.3040106@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Dec 2014 23:58:13 -0000 On Sun, Dec 21, 2014 at 03:22:25PM -0800, Lacey Powers wrote: > Hello Everyone, > > I was attempting to build and use PostgreSQL with dtrace on FreeBSD 10.1 on > my home workstation. > > It builds, and the binary works, but fails to register any probes. > > After double checking that I had the dtraceall kernel module loaded, > changing permissions on /dev/dtrace/helper (0666), verifying that > devel/libelf was loaded, and digging around source code and Google for debug > flags, I'm at a loss for what else to do. > > Here is the error: > > [pgsql@talizorah ~]$ DTRACE_DOF_INIT_DEBUG=1 /usr/local/bin/postgres -D > /usr/local/pgsql/9.4/data > dtrace DOF postgres: elf_begin failed > LOG: ending log output to stderr > HINT: Future log output will go to log destination "syslog". > dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1) > dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1) > dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1) > ^Cdtrace DOF postgres: dtrace DOF postgres: DTrace ioctl failed to remove > DOF (-1) > DTrace ioctl failed to remove DOF (-1) > dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1) > dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1) > dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1) > dtrace DOF postgres: DTrace ioctl failed to remove DOF (-1) > [pgsql@talizorah ~]$ Hi Lacey, I've never seen this particular problem before. Could you post the output of "ldd /usr/local/bin/postgres"? I've never tried using libelf from ports, so perhaps there's a problem with it, assuming it is indeed being used (as opposed to the base system's libelf). If the ports libelf is being used (/usr/local/lib/libelf.so will show up in the ldd ouput if so), could you try deleting devel/libelf, rebuilding postgres, and trying again? If not, or if other packages require devel/libelf on your system, could you apply the patch below, rebuild drti, rebuild postgres (in that order), and try again? To rebuild drti, cd to /usr/src/cddl/lib/drti and run "make && make install". Thanks! -Mark diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c index ccd4f9b..eafc4c6 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c @@ -158,7 +158,7 @@ dtrace_dof_init(void) return; } if ((e = elf_begin(efd, ELF_C_READ, NULL)) == NULL) { - dprintf(1, "elf_begin failed\n"); + dprintf(1, "elf_begin failed: %s\n", elf_errmsg(elf_errno())); close(efd); return; }