Pgpool接続を強制切断すると
pgpool.logに下記のようなログがいっぱい出力された〜
ERROR: ・・・ read_startup_packet: incorrect packet length (-465498) ERROR: ・・・ read_startup_packet: out of memory
これは、接続が不正に接続された場合に出力されるエラーのようで、今回は、TELNETで接続していた接続を、Ctrl+Cで強制切断したから出たみたい。
少しだけソースを調べてみると、Pgpoolの「read_startup_packet」という関数の中で、このエラーは発生しているようでした。
http://www.jonahharris.com/osdb/pgsql/pgpool2/pgpool-II-1.0.1/child.c
static StartupPacket *read_startup_packet(POOL_CONNECTION *cp) { StartupPacket *sp; StartupPacket_v2 *sp2; int protov; int len; char *p; sp = (StartupPacket *)calloc(sizeof(*sp), 1); if (!sp) { pool_error("read_startup_packet: out of memory"); return NULL; } /* read startup packet length */ if (pool_read(cp, &len, sizeof(len))) { return NULL; } len = ntohl(len); len -= sizeof(len); if (len <= 0) { pool_error("read_startup_packet: incorrect packet length (%d)", len); } sp->startup_packet = calloc(len, 1); if (!sp->startup_packet) { pool_error("read_startup_packet: out of memory"); pool_free_startup_packet(sp); return NULL; } /* read startup packet */ if (pool_read(cp, sp->startup_packet, len)) { pool_free_startup_packet(sp); return NULL; } sp->len = len; memcpy(&protov, sp->startup_packet, sizeof(protov)); sp->major = ntohl(protov)>>16; sp->minor = ntohl(protov) & 0x0000ffff; p = sp->startup_packet; switch(sp->major) { case PROTO_MAJOR_V2: /* V2 */ sp2 = (StartupPacket_v2 *)(sp->startup_packet); sp->database = calloc(SM_DATABASE+1, 1); if (!sp->database) { pool_error("read_startup_packet: out of memory"); pool_free_startup_packet(sp); return NULL; } strncpy(sp->database, sp2->database, SM_DATABASE); sp->user = calloc(SM_USER+1, 1); if (!sp->user) { pool_error("read_startup_packet: out of memory"); pool_free_startup_packet(sp); return NULL; } strncpy(sp->user, sp2->user, SM_USER); break; case PROTO_MAJOR_V3: /* V3 */ p += sizeof(int); /* skip protocol version info */ while(*p) { if (!strcmp("user", p)) { p += (strlen(p) + 1); sp->user = strdup(p); if (!sp->user) { pool_error("read_startup_packet: out of memory"); pool_free_startup_packet(sp); return NULL; } } else if (!strcmp("database", p)) { p += (strlen(p) + 1); sp->database = strdup(p); if (!sp->database) { pool_error("read_startup_packet: out of memory"); pool_free_startup_packet(sp); return NULL; } } p += (strlen(p) + 1); } break; case 1234: /* cancel or SSL request */ /* set dummy database, user info */ sp->database = calloc(1, 1); if (!sp->database) { pool_error("read_startup_packet: out of memory"); pool_free_startup_packet(sp); return NULL; } sp->user = calloc(1, 1); if (!sp->user) { pool_error("read_startup_packet: out of memory"); pool_free_startup_packet(sp); return NULL; } break; default: pool_error("read_startup_packet: invalid major no: %d", sp->major); pool_free_startup_packet(sp); return NULL; } pool_debug("Protocol Major: %d Minor: %d database: %s user: %s", sp->major, sp->minor, sp->database, sp->user); return sp; }