Re: Broken stuff in new dtrace probes - Mailing list pgsql-hackers

From Robert Lor
Subject Re: Broken stuff in new dtrace probes
Date
Msg-id 49C9275C.6010206@sun.com
Whole thread Raw
In response to Broken stuff in new dtrace probes  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Just returned from vacation ...

Tom Lane wrote:
> I notice that we have in md.c
>
>     TRACE_POSTGRESQL_SMGR_MD_READ_DONE(forknum, blocknum, reln->smgr_rnode.spcNode, reln->smgr_rnode.dbNode,
reln->smgr_rnode.relNode,relpath(reln->smgr_rnode, forknum), nbytes, BLCKSZ);
 
>
>     TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE(forknum, blocknum, reln->smgr_rnode.spcNode, reln->smgr_rnode.dbNode,
reln->smgr_rnode.relNode,relpath(reln->smgr_rnode, forknum), nbytes, BLCKSZ);
 
>
> relpath() returns a palloc'd string, which will not get freed, which
> means that any serious use of these probe points will shortly blow out
> the backend's memory.  So far as I can see the path argument is
> redundant with the other probe arguments and we might as well just
> remove it --- objections?
>   
agreed; the other arguments can be used to get the same result.
> There's another problem in tuplesort.c:
>
>     TRACE_POSTGRESQL_SORT_DONE(state->tapeset,
>             (state->tapeset ? LogicalTapeSetBlocks(state->tapeset) :
>             (state->allowedMem - state->availMem + 1023) / 1024));
>
> This is called after state->tapeset has been freed, which means that the
> LogicalTapeSetBlocks call will very likely give a wrong answer,
> especially in assert-enabled builds but maybe even in a regular one.
>
>             
Good catch and thanks for reviewing the probes.

-Robert


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Function C and INOUT parameters
Next
From: Andrew Gierth
Date:
Subject: hstore patch, part 2