Hi,

From: Nico -telmich- Schottelius <[EMAIL PROTECTED]>
Subject: Re: [Pgpool-general] pgpool2.1b2 segfaulting
Date: Fri, 16 May 2008 15:14:21 +0200

> GDB infos:

Thanks!

Could you apply the attached patch?

Regards,

--
Yoshiyuki Asaba
[EMAIL PROTECTED]
Index: pool_process_query.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pool_process_query.c,v
retrieving revision 1.107
diff -c -r1.107 pool_process_query.c
*** pool_process_query.c        3 Apr 2008 13:10:34 -0000       1.107
--- pool_process_query.c        16 May 2008 15:18:58 -0000
***************
*** 2205,2211 ****
        int i, j;
        unsigned char mask;
        int size, size1 = 0;
!       char *buf = NULL;
        char msgbuf[1024];
  
        pool_write(frontend, "D", 1);
--- 2205,2211 ----
        int i, j;
        unsigned char mask;
        int size, size1 = 0;
!       char *buf = NULL, *sendbuf = NULL;
        char msgbuf[1024];
  
        pool_write(frontend, "D", 1);
***************
*** 2251,2259 ****
                        /* field size */
                        if (pool_read(MASTER(backend), &size, sizeof(int)) < 0)
                                return POOL_END;
                        /* forward to frontend */
                        pool_write(frontend, &size, sizeof(int));
!                       size1 = size;
                        for (j=0;j<NUM_BACKENDS;j++)
                        {
                                if (VALID_BACKEND(j) && !IS_MASTER_NODE_ID(j))
--- 2251,2273 ----
                        /* field size */
                        if (pool_read(MASTER(backend), &size, sizeof(int)) < 0)
                                return POOL_END;
+ 
+                       size1 = ntohl(size) - 4;
+ 
+                       /* read and send actual data only when size > 0 */
+                       if (size1 > 0)
+                       {
+                               sendbuf = pool_read2(MASTER(backend), size1);
+                               if (sendbuf == NULL)
+                                       return POOL_END;
+                       }
+ 
                        /* forward to frontend */
                        pool_write(frontend, &size, sizeof(int));
!                       pool_write(frontend, sendbuf, size1);
!                       snprintf(msgbuf, Min(sizeof(msgbuf), size1+1), "%s", 
sendbuf);
!                       pool_debug("AsciiRow: len: %d data: %s", size1, msgbuf);
! 
                        for (j=0;j<NUM_BACKENDS;j++)
                        {
                                if (VALID_BACKEND(j) && !IS_MASTER_NODE_ID(j))
***************
*** 2261,2291 ****
                                        /* field size */
                                        if (pool_read(CONNECTION(backend, j), 
&size, sizeof(int)) < 0)
                                                return POOL_END;
-                               }
-                               /* XXX: field size maybe different among
-                                  backends. If we were a paranoid, we have to 
treat
-                                  this as a fatal error. However in the real 
world
-                                  we'd better to adapt this situation. Just 
throw a
-                                  log... */
-                               if (size != size1)
-                                       pool_debug("AsciiRow: %d th field size 
does not match between master(%d) and %d th backend(%d)",
-                                                          i, ntohl(size), j, 
ntohl(size1));
  
!                               buf = NULL;
!                               size = ntohl(size) - 4;
  
!                               /* read and send actual data only when size > 0 
*/
!                               if (size > 0)
!                               {
!                                       buf = pool_read2(CONNECTION(backend, 
j), size);
!                                       if (buf == NULL)
!                                               return POOL_END;
  
!                                       if (IS_MASTER_NODE_ID(j))
                                        {
!                                               pool_write(frontend, buf, size);
!                                               snprintf(msgbuf, 
Min(sizeof(msgbuf), size+1), "%s", buf);
!                                               pool_debug("AsciiRow: len: %d 
data: %s", size, msgbuf);
                                        }
                                }
                        }
--- 2275,2299 ----
                                        /* field size */
                                        if (pool_read(CONNECTION(backend, j), 
&size, sizeof(int)) < 0)
                                                return POOL_END;
  
!                                       buf = NULL;
!                                       size = ntohl(size) - 4;
  
!                                       /* XXX: field size maybe different among
!                                          backends. If we were a paranoid, we 
have to treat
!                                          this as a fatal error. However in 
the real world
!                                          we'd better to adapt this situation. 
Just throw a
!                                          log... */
!                                       if (size != size1)
!                                               pool_debug("AsciiRow: %d th 
field size does not match between master(%d) and %d th backend(%d)",
!                                                                  i, 
ntohl(size), j, ntohl(size1));
  
!                                       /* read and send actual data only when 
size > 0 */
!                                       if (size > 0)
                                        {
!                                               buf = 
pool_read2(CONNECTION(backend, j), size);
!                                               if (buf == NULL)
!                                                       return POOL_END;
                                        }
                                }
                        }
_______________________________________________
Pgpool-general mailing list
[email protected]
http://pgfoundry.org/mailman/listinfo/pgpool-general

Reply via email to