Re: [report] memory leaks in COPY FROM on partitioned table - Mailing list pgsql-hackers

From Andres Freund
Subject Re: [report] memory leaks in COPY FROM on partitioned table
Date
Msg-id 20180801204411.y7xntf4fbrg6bnz7@alap3.anarazel.de
Whole thread Raw
In response to Re: [report] memory leaks in COPY FROM on partitioned table  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: [report] memory leaks in COPY FROM on partitioned table
List pgsql-hackers
On 2018-08-01 16:38:11 -0400, Alvaro Herrera wrote:
> On 2018-Jul-24, Amit Langote wrote:
> 
> > Your patch takes care of allocation happening inside
> > get_partition_for_tuple, but as you mention there might be others in its
> > caller ExecFindPartition.  So, I think we should switch to the per-tuple
> > context in ExecFindPartition.
> 
> Right, makes sense.  Pushed that way.

The buildfarm does not like this one:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=desmoxytes&dt=2018-08-01%2020%3A40%3A02
(and a lot of other reports from my animals)

================== stack trace: pgsql.build/src/test/regress/tmp_check/data/core ==================
[New LWP 10463]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `postgres: bf regression [local] INSERT                                        '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  slot_getattr (slot=slot@entry=0x5606e413dd90, attnum=1, isnull=isnull@entry=0x7ffcb8c35570) at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/access/common/heaptuple.c:1569
1569        if (attnum > HeapTupleHeaderGetNatts(tup))
#0  slot_getattr (slot=slot@entry=0x5606e413dd90, attnum=1, isnull=isnull@entry=0x7ffcb8c35570) at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/access/common/heaptuple.c:1569
#1  0x00005606e1fe5744 in FormPartitionKeyDatum (pd=0x5606e4140670, pd=0x5606e4140670, isnull=0x7ffcb8c35590,
values=0x7ffcb8c355b0,estate=0x5606e419f8d8, slot=0x5606e413dd90) at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/executor/execPartition.c:1077
#2  ExecFindPartition (resultRelInfo=resultRelInfo@entry=0x5606e419fb28, pd=0x5606e4140888, slot=0x5606e413dd90,
estate=estate@entry=0x5606e419f8d8)at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/executor/execPartition.c:245
#3  0x00005606e2005452 in ExecPrepareTupleRouting (mtstate=mtstate@entry=0x5606e419fc40,
estate=estate@entry=0x5606e419f8d8,proute=proute@entry=0x5606e413daf0,
targetRelInfo=targetRelInfo@entry=0x5606e419fb28,slot=<optimized out>) at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/executor/nodeModifyTable.c:1713
#4  0x00005606e20076ff in ExecModifyTable (pstate=0x5606e419fc40) at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/executor/nodeModifyTable.c:2159
#5  0x00005606e1fe008a in ExecProcNode (node=0x5606e419fc40) at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/include/executor/executor.h:237
#6  ExecutePlan (execute_once=<optimized out>, dest=0x5606e4365e10, direction=<optimized out>, numberTuples=0,
sendTuples=<optimizedout>, operation=CMD_INSERT, use_parallel_mode=<optimized out>, planstate=0x5606e419fc40,
estate=0x5606e419f8d8)at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/executor/execMain.c:1721
#7  standard_ExecutorRun (queryDesc=0x5606e40addf8, direction=<optimized out>, count=0, execute_once=<optimized out>)
at/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/executor/execMain.c:362
 
#8  0x00005606e2142ff2 in ProcessQuery (plan=<optimized out>, sourceText=0x5606e3ff6868 "INSERT INTO pagg_tab_ml SELECT
i% 30, i % 10, to_char(i % 4, 'FM0000') FROM generate_series(0, 29999) i;", params=0x0, queryEnv=0x0,
dest=0x5606e4365e10,completionTag=0x7ffcb8c35ac0 "") at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/tcop/pquery.c:161
#9  0x00005606e214326b in PortalRunMulti (portal=portal@entry=0x5606e405cf08, isTopLevel=isTopLevel@entry=true,
setHoldSnapshot=setHoldSnapshot@entry=false,dest=dest@entry=0x5606e4365e10, altdest=altdest@entry=0x5606e4365e10,
completionTag=completionTag@entry=0x7ffcb8c35ac0"") at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/tcop/pquery.c:1286
#10 0x00005606e2143efd in PortalRun (portal=portal@entry=0x5606e405cf08, count=count@entry=9223372036854775807,
isTopLevel=isTopLevel@entry=true,run_once=run_once@entry=true, dest=dest@entry=0x5606e4365e10,
altdest=altdest@entry=0x5606e4365e10,completionTag=0x7ffcb8c35ac0 "") at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/tcop/pquery.c:799
#11 0x00005606e213f8fa in exec_simple_query (query_string=0x5606e3ff6868 "INSERT INTO pagg_tab_ml SELECT i % 30, i %
10,to_char(i % 4, 'FM0000') FROM generate_series(0, 29999) i;") at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/tcop/postgres.c:1122
#12 0x00005606e214185f in PostgresMain (argc=<optimized out>, argv=argv@entry=0x5606e4021688, dbname=<optimized out>,
username=<optimizedout>) at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/tcop/postgres.c:4153
#13 0x00005606e1e242cb in BackendRun (port=0x5606e401a530) at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/postmaster/postmaster.c:4361
#14 BackendStartup (port=0x5606e401a530) at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/postmaster/postmaster.c:4033
#15 ServerLoop () at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/postmaster/postmaster.c:1706
#16 0x00005606e20c361d in PostmasterMain (argc=8, argv=0x5606e3ff24c0) at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/postmaster/postmaster.c:1379
#17 0x00005606e1e25fc3 in main (argc=8, argv=0x5606e3ff24c0) at
/home/bf/build/buildfarm-desmoxytes/HEAD/pgsql.build/../pgsql/src/backend/main/main.c:228

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [report] memory leaks in COPY FROM on partitioned table
Next
From: Alvaro Herrera
Date:
Subject: Re: [report] memory leaks in COPY FROM on partitioned table