Date: Sat, 27 Jul 2013 19:51:03 -0400 From: Mark Johnston <markj@freebsd.org> To: freebsd-dtrace@freebsd.org Subject: PostgreSQL+DTrace on FreeBSD Message-ID: <20130727235103.GA11294@charmander.uwaterloo.ca>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130727235103.GA11294>