View Issue Details

IDProjectCategoryView StatusLast Update
0000082Pgpool-IIBugpublic2013-11-11 21:01
Reporterserge.logvinovAssigned To 
PrioritylowSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000082: segfault in pool_auth.c if master is down
DescriptionIF MASTER_CONNECTION(cp) not set function MAJOR(cp) kill process.

FIX:
$git branch
* V3_2_STABLE
$git diff main.c pool_auth.c pool_connection_pool.c pool_process_context.c

#######
# More debug info on startup
# and find next node if first is dead

diff --git a/main.c b/main.c
index 52efeb9..41b46fb 100644
--- a/main.c
+++ b/main.c
@@ -689,6 +689,8 @@ int main(int argc, char **argv)

        /* Save primary node id */
        Req_info->primary_node_id = find_primary_node();
+ pool_log("main: primary node: %d", Req_info->primary_node_id);
+ pool_log("main: master node: %d", Req_info->master_node_id);

        /*
         * This is the main loop
@@ -2745,7 +2747,7 @@ static int find_primary_node(void)
                if (!s)
                {
                        pool_error("find_primary_node: make_persistent_connection failed");
- return -1;
+ continue;
                }
                con = s->con;
 #ifdef NOT_USED

diff --git a/pool_auth.c b/pool_auth.c
index ff457a0..a4e74e2 100644
--- a/pool_auth.c
+++ b/pool_auth.c
@@ -68,6 +68,8 @@ int pool_do_auth(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp)
        int i;
        StartupPacket *sp;

+ if (MASTER_CONNECTION(cp) == NULL)
+ return -1;
        protoMajor = MAJOR(cp);

        kind = pool_read_kind(cp);




####
# Do not inc() connection counter for dead link

diff --git a/pool_connection_pool.c b/pool_connection_pool.c
index 47faac9..79a9b0f 100644
--- a/pool_connection_pool.c
+++ b/pool_connection_pool.c
@@ -118,6 +118,8 @@ POOL_CONNECTION_POOL *pool_get_cp(char *user, char *database, int protoMajor, in
                        MASTER_CONNECTION(p)->closetime = 0;
                        for (j=0;j<NUM_BACKENDS;j++)
                        {
+ if (!VALID_BACKEND(j))
+ continue;
                                p->info[j].counter++;
                        }
                        POOL_SETMASK(&oldmask);



####
# Do not show pool_connected=1 for dead link

diff --git a/pool_process_context.c b/pool_process_context.c
index e58103a..c724be8 100644
--- a/pool_process_context.c
+++ b/pool_process_context.c
@@ -208,6 +208,8 @@ void pool_coninfo_set_frontend_connected(int proc_id, int pool_index)

        for (i=0;i<NUM_BACKENDS;i++)
        {
+ if (!VALID_BACKEND(i))
+ continue;
                con = pool_coninfo(proc_id, pool_index, i);

                if (con == NULL)
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2013-11-11 13:29 serge.logvinov New Issue
2013-11-11 21:01 t-ishii Changeset attached => pgpool2 master 48b290f5
2013-11-11 21:01 t-ishii Changeset attached => pgpool2 V3_1_STABLE e3ca4d32
2013-11-11 21:01 t-ishii Changeset attached => pgpool2 V3_0_STABLE 54fb245e