Re: 9.3.5 failing to compile with dtrace on FreeBSD 10.1

From: Lacey Powers <lacey(dot)leanne(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: 9.3.5 failing to compile with dtrace on FreeBSD 10.1
Date: 2014-12-22 19:22:20
Message-ID: 54986F6C.1010704@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Luca,

I had some success getting PostgreSQL 9.4 to build on FreeBSD 10.1-p2
RELEASE with DTrace. The probes look fully functional, and fun to work
with, though I haven't had time to get incredibly deep into using
them.This is what worked for me, after much digging around.

I was building and running PostgreSQL and dtrace directly on my
workstation, not in a jail. I'm not sure what additional hoops would
need to hopped through off-hand to run dtrace on FreeBSD in a jail.

Initially, I got compile errors, but I tracked those down and realized
that I needed to load the dtrace kernel modules, which I had expected to
be loaded automatically, but weren't. Otherwise, you get cryptic compile
errors.

I had to load the dtrace kernel modules with:

kldload dtraceall (and enable it in /boot/loader.conf with
dtraceall_load="YES", if you want it to hang around)

Add the following lines to your /etc/make.conf (because detailed
backtraces are helpful)

STRIP=
CFLAGS+=-fno-omit-frame-pointer

Once that's loaded, change the permissions to 0666 on /dev/dtrace/helper
(and add that to /etc/devfs.conf with "perm /dev/dtrace/helper 0666" if
you want it to persist)

Though be aware that there are security implications for that, since
other users could make a ton of probes and exhaust kernel memory.
Alternately, you could add pgsql to wheel, since root and wheel are the
owner and group for that devfs node.

Also be sure to not use devel/libelf from ports, because that doesn't
seem to play nice with dtrace, and keeps probes from registering.

After doing all that, I could get dtrace to build, link, and register
userland probes with the database/postgresql94-server and
database/postgresql94-client, and successfully count transaction times
in a dtrace script.

One final note, the freebsd-dtrace(at)freebsd(dot)org list, is very helpful
with esoteric DTrace issues.

I hope this all helps. =)

Regards,

Lacey

> On Tue, Dec 16, 2014 at 4:06 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> If you want to push on this I think you'll need to find a BSD dtrace
>> expert. You shouldn't need to show him/her much except the above
>> dtrace invocation and the probes.d file.
>>
> I've filled a bug report and I'll report back here if I get any update
> on the matter.
> In the meantime I've tried 9.4 beta and the same issue arises.
>
> Luca
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2014-12-23 02:55:56 psql feature request: --list-conninfo (dump the config info psql would use to connect)
Previous Message Adrian Klaver 2014-12-22 15:07:11 Re: how to append records from dump to existing database?