[pgpool-committers: 5580] pgpool: Fix memory leak in "batch" mode in extended query.

Tatsuo Ishii ishii at sraoss.co.jp
Fri Mar 29 16:15:01 JST 2019


Fix memory leak in "batch" mode in extended query.

In "batch" mode, not for every execute message, a sync message is
followed.  Unfortunately Pgpool-II only discard memory of query
context for the last execute message while processing the ready for
query message. For example if 3 execute messages are sent before the
sync message, 2 of query context memory will not be freed and this
leads to serious memory leak.

To fix the problem, now the query context memory is possibly discarded
when a command complete message is returned from backend if the query
context is not referenced either by sent messages or pending messages.
If it is not referenced at all, we can discard the query context.

Also even if it is referenced, it is ok to discard the query context
if it is either an unnamed statement or an unnamed portal because it
will be discarded anyway when next unnamed statement or portal is
created.

Per bug 468.

Branch
------
V4_0_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=368859250602b117892afb7caa520bb8999cd346

Modified Files
--------------
src/context/pool_query_context.c           |  3 +-
src/context/pool_session_context.c         | 49 +++++++++++++++++++++++++++++-
src/include/context/pool_session_context.h |  2 ++
src/protocol/CommandComplete.c             | 25 +++++++++++++++
4 files changed, 77 insertions(+), 2 deletions(-)



More information about the pgpool-committers mailing list