pgpool2.git / summary / log / commit / refs

commit    300ee4254796e18a6b6240a0cfec148b4936a329
Author:   Toshihiro Kitagawa <kitagawa at sraoss.co.jp>
Date:     Tue Oct 19 08:57:18 2010 +0000

    Fix hungup when a query sent to one node caused an error.


pool_proto_modules.c | 10 +++++----- pool_session_context.c | 13 ++++++++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pool_proto_modules.c b/pool_proto_modules.c index 24d4851a3..5a6df6364 100644 --- a/pool_proto_modules.c +++ b/pool_proto_modules.c @@ -1679,11 +1679,6 @@ POOL_STATUS ErrorResponse3(POOL_CONNECTION *frontend, { POOL_STATUS ret; - /* An error occurred with PREPARE or DEALLOCATE command. - * Free pending portal object. - */ - pool_remove_pending_objects(); - ret = SimpleForwardToFrontend('E', frontend, backend); if (ret != POOL_CONTINUE) return ret; @@ -1747,6 +1742,11 @@ POOL_STATUS ErrorResponse3(POOL_CONNECTION *frontend, } #endif + /* An error occurred with PREPARE or DEALLOCATE command. + * Free pending portal object. + */ + pool_remove_pending_objects(); + return POOL_CONTINUE; } diff --git a/pool_session_context.c b/pool_session_context.c index 540b9933d..f538ce62c 100644 --- a/pool_session_context.c +++ b/pool_session_context.c @@ -548,7 +548,11 @@ void pool_remove_pending_objects(void) pool_memory_free(session_context->memory_context, ps->name); if (ps && ps->qctxt) - pool_query_context_destroy(ps->qctxt); + { + if (can_prepared_statement_destroy(ps->qctxt) && + can_portal_destroy(ps->qctxt)) + pool_query_context_destroy(ps->qctxt); + } if (ps) pool_memory_free(session_context->memory_context, ps); @@ -561,6 +565,13 @@ void pool_remove_pending_objects(void) if (p && p->pstmt) pool_memory_free(session_context->memory_context, p->pstmt); + if (p && p->qctxt) + { + if (can_portal_destroy(p->qctxt) && + can_prepared_statement_destroy(p->qctxt)) + pool_query_context_destroy(p->qctxt); + } + if (p) pool_memory_free(session_context->memory_context, p); [parent: cfa993268b4a]