pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Plug leak in BuildTupleHashTable by creating ExprContext in corr
2+ messages / 1 participants
[nested] [flat]

* pgsql: Plug leak in BuildTupleHashTable by creating ExprContext in corr
@ 2019-02-09 09:38 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Andres Freund @ 2019-02-09 09:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Plug leak in BuildTupleHashTable by creating ExprContext in correct context.

In bf6c614a2f2c5 I added a expr context to evaluate the grouping
expression. Unfortunately the code I added initialized them while in
the calling context, rather the table context.  Additionally, I used
CreateExprContext() rather than CreateStandaloneExprContext(), which
creates the econtext in the estate's query context.

Fix that by using CreateStandaloneExprContext when in the table's
tablecxt. As we rely on the memory being freed by a memory context
reset that means that the econtext's shutdown callbacks aren't being
called, but that seems ok as the expressions are tightly controlled
due to ExecBuildGroupingEqual().

Bug: #15592
Reported-By: Dmitry Marakasov
Author: Andres Freund
Discussion: https://postgr.es/m/20190114222838.h6r3fuyxjxkykf6t@alap3.anarazel.de
Backpatch: 11, where I broke this in bf6c614a2f2c5

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5567d12ce030781a4f749c9cd2034b95a3b64424

Modified Files
--------------
src/backend/executor/execGrouping.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Plug leak in BuildTupleHashTable by creating ExprContext in corr
@ 2019-02-09 09:38 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Andres Freund @ 2019-02-09 09:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Plug leak in BuildTupleHashTable by creating ExprContext in correct context.

In bf6c614a2f2c5 I added a expr context to evaluate the grouping
expression. Unfortunately the code I added initialized them while in
the calling context, rather the table context.  Additionally, I used
CreateExprContext() rather than CreateStandaloneExprContext(), which
creates the econtext in the estate's query context.

Fix that by using CreateStandaloneExprContext when in the table's
tablecxt. As we rely on the memory being freed by a memory context
reset that means that the econtext's shutdown callbacks aren't being
called, but that seems ok as the expressions are tightly controlled
due to ExecBuildGroupingEqual().

Bug: #15592
Reported-By: Dmitry Marakasov
Author: Andres Freund
Discussion: https://postgr.es/m/20190114222838.h6r3fuyxjxkykf6t@alap3.anarazel.de
Backpatch: 11, where I broke this in bf6c614a2f2c5

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9cf37a527cf83e94f8f166d380baf53287a0337b

Modified Files
--------------
src/backend/executor/execGrouping.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-02-09 09:38 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-02-09 09:38 pgsql: Plug leak in BuildTupleHashTable by creating ExprContext in corr Andres Freund <andres@anarazel.de>
2019-02-09 09:38 pgsql: Plug leak in BuildTupleHashTable by creating ExprContext in corr Andres Freund <andres@anarazel.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox