Re: DTrace build dependency rules

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Mark Johnston <markj(at)freebsd(dot)org>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DTrace build dependency rules
Date: 2015-08-18 14:04:23
Message-ID: CA+Tgmoa9NP2OnbmaxQRd-73mJjpSyTkP7jtpg35CngZ+kG6C0Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 15, 2015 at 6:45 PM, Mark Johnston <markj(at)freebsd(dot)org> wrote:
> There seems to be a bug in the make rules when DTrace is enabled. It
> causes dtrace -G to be invoked twice when building PostgreSQL as a
> FreeBSD port: once during the build itself, and once during
> installation. For a long time this has been worked around on FreeBSD
> with a change to libdtrace itself, but this workaround is proving
> problematic and I'd like to fix the problem properly. I'm not sure
> whether the problem has been observed on other operating systems that
> support DTrace.
>
> The bug is in src/backend/Makefile. probes.o, the dtrace(1)-generated
> object file, depends on the objfiles.txt for each of the backend
> subdirs. These files depend in turn on the object files themselves; if
> objfiles.txt is out of date with respect to one of its object files, the
> mtime of objfiles.txt is updated with "touch" (see backend/common.mk).
> The problem is that dtrace -G, which runs at the end of the build,
> modifies a number of object files (it overwrites their probe sites with
> NOPs), thus making their corresponding objfiles.txt out of date. Then,
> when "make install" traverses the backend subdirs, it updates
> objfiles.txt, which causes probes.o to be rebuilt, resulting in an error
> from dtrace(1).

Gosh, that's pretty ugly. I would have thought it would be a real
no-no to update the .o file once it got generated. If nothing else, a
modification to the .c file concurrent with a make invocation might
lead to the .o not getting rebuilt the next time make is run.

> The attached patch fixes the problem by having probes.o depend on object
> files directly, rather than on objfiles.txt. I've tested it with
> PostgreSQL 9.0-9.4 on FreeBSD CURRENT.

I don't see a particular reason not to make this change, though.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2015-08-18 14:06:37 Re: WIP: SCRAM authentication
Previous Message Kouhei Kaigai 2015-08-18 14:02:44 Bug? ExecChooseHashTableSize() got assertion failed with crazy number of rows