From owner-freebsd-dtrace@FreeBSD.ORG Sat Jul 27 23:50:16 2013 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 983D4848 for ; Sat, 27 Jul 2013 23:50:16 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qe0-x232.google.com (mail-qe0-x232.google.com [IPv6:2607:f8b0:400d:c02::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5ABA42966 for ; Sat, 27 Jul 2013 23:50:16 +0000 (UTC) Received: by mail-qe0-f50.google.com with SMTP id q19so791090qeb.37 for ; Sat, 27 Jul 2013 16:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=OKgVNFbKuZgp8oNEIJSp2T+i+5xxD/WMbfdEEnOF4fQ=; b=tYzYjzmx1WSdHnxufhSK5PBBdbPxCXNA9zmXjmMGAfFTrUBD5S7YYE5LdwmzWUh1d0 HJ/nYNKxXiXOkWHt/u5g9OAKWgKkmP5ZQrZDbnEO0e7b8zm05aHQbvsZkGm81lpm/CXh Q/CqE9UeFTXNUkFNXfbIj1STdTl9kzEfdR6yJUIniu+5kzOhNWn5HKK5TUrNGjP3OZOf YIyNUn05XshWPKDYlCueR6EhQGvdriS8dCPueHm0B4Pv5Eu53pX0FLlVE+K8VsT5FTbC kj2NQheqgwzfWsTas8y6/46PG2pt+ZLepfdeoc4bsthFlByF9CpGtH3gNxv5bzZqrgje asqQ== X-Received: by 10.49.132.69 with SMTP id os5mr63110005qeb.48.1374969015499; Sat, 27 Jul 2013 16:50:15 -0700 (PDT) Received: from charmander.uwaterloo.ca (cn-nat2-uw-129-97-124-74.net.uwaterloo.ca. [129.97.124.74]) by mx.google.com with ESMTPSA id nh4sm11786489qeb.6.2013.07.27.16.50.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 27 Jul 2013 16:50:14 -0700 (PDT) Sender: Mark Johnston Date: Sat, 27 Jul 2013 19:51:03 -0400 From: Mark Johnston To: freebsd-dtrace@freebsd.org Subject: PostgreSQL+DTrace on FreeBSD Message-ID: <20130727235103.GA11294@charmander.uwaterloo.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.14 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: Sat, 27 Jul 2013 23:50:16 -0000 Hello, I saw that there were a couple of questions about postgres' DTrace support on FreeBSD (OP CC'ed): http://lists.freebsd.org/pipermail/freebsd-dtrace/2013-June/000007.html http://lists.freebsd.org/pipermail/freebsd-questions/2013-May/250843.html I've just spent a bit of time playing with postgres 9.3's USDT probes on CURRENT and managed to get them to work. Some troubleshooting was needed first though, so I thought I'd describe what I needed to do. First, the compile error reported in the posts above should be fixed by r247221, which I MFCed to stable/8 and 9 a month and a half ago. In particular, you'll need r251582 if you want to use the postgresql provider on stable/9: http://svnweb.freebsd.org/base?view=revision&revision=251582 I have some uncommitted changes to my local tree which may also be needed, but I suspect they aren't. I don't have a stable/9 system to test with though. Second, the permissions on /dev/dtrace/helper are too restrictive. On my system the defaults are 0660 with o=root,g=wheel. That happens to work out most of the time because my main user is in the wheel group, but postgres wants to run as pgsql and so the code which creates postgres' probes can't run. I'm not sure what the right solution to this problem is. For testing purposes I just changed the mode to 0666, but I guess that's not a great idea in general since it lets unprivileged users exhaust kernel memory by creating an unbounded number of probes. It'd be easy to add a sysctl limit on the number of probes allowed for a non-root process though, if such a thing doesn't already exist. Another solution is to just add pgsql to the wheel group; I don't really know what the security implications of this are though. Does anyone have any thoughts on this? Finally, it's probably a good idea to compile the postgres port with the DEBUG option on. When it's omitted I see the following warning as postgres starts: # service postgresql onestart WARNING: number of probes fixed does not match the number of defined probes (60 != 72, respectively) WARNING: some probes might not fire or your program might crash WARNING: number of probes fixed does not match the number of defined probes (60 != 72, respectively) WARNING: some probes might not fire or your program might crash I've seen this before with other programs. I'm not quite sure what it means or where it comes from, perhaps someone else on this list knows. Looking into it is on my todo list. :) -Mark