[pgpool-general-jp: 1037] replication モード使用時の pgpool-3.1.2 の segfault に関して

さいとう まさと zon @ yd6.so-net.ne.jp
2012年 2月 10日 (金) 15:19:45 JST


皆様、初めまして、斉藤ともうします。

Postgres を使うアプリケーションから
pgpool2 をレプリケーションモードで使用して、マスターとスレーブの DB に
同一データを保持させようとしています。

pgpool2 を参照させずに、直接にマスター DB を見る状態であれば、
問題なくアプリが動作するのですが、
pgpool2 経由ですとアプリの処理途中で、pgpool2 が segfault してしまう状態です。

設定としましては
x86_64 の CentOS 5.7 にソースから pgpool2-3.1.2 をインストールして、
pgpool.conf.sample-replication をベースにして設定しています。

pgpool -n で起動させて core ファイルを見てみると以下のようになっています。


Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging
symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2

warning: no loadable sections found in added symbol-file
system-supplied DSO at 0x7fff293fd000
Core was generated by `pgpool: lr'.
Program terminated with signal 11, Segmentation fault.
#0  pool_memory_alloc (pool=0x6214720, size=156) at pool_memory.c:93
93				pool->freelist[fidx] = chunk->header.next;
(gdb) where
#0  pool_memory_alloc (pool=0x6214720, size=156) at pool_memory.c:93
#1  0x000000000044481d in pool_create_sent_message (kind=80 'P',
len=156, contents=0x621d1e0 "", num_tsparams=0,
    name=0x621d1e0 "", query_context=0x6224900) at pool_session_context.c:508
#2  0x00000000004420ce in Parse (frontend=0x6216ab0,
backend=0x6215a80, len=156, contents=0x621d1e0 "")
    at pool_proto_modules.c:702
#3  0x0000000000443470 in ProcessFrontendResponse (frontend=0x6216ab0,
backend=0x6215a80) at pool_proto_modules.c:2062
#4  0x0000000000417c15 in pool_process_query (frontend=0x6216ab0,
backend=0x6215a80, reset_request=0)
    at pool_process_query.c:344
#5  0x0000000000409842 in do_child (unix_fd=5, inet_fd=6) at child.c:354
#6  0x0000000000403ee5 in fork_a_child (unix_fd=5, inet_fd=6, id=17)
at main.c:1072
#7  0x0000000000406bd1 in main (argc=<value optimized out>,
argv=<value optimized out>) at main.c:549
(gdb) q

この際の pgpool2 自体のログは verbose で出力させまして、以下のように
なっています。最後に Child process が segfault というのが出ております。

pgpool[29578]: pool_read_message_length: slot: 1 length: 5
pgpool[29578]: ReadyForQuery: transaction state:I
pgpool[29578]: pool_set_writing_transaction: done
pgpool[29578]: pool_unset_query_in_progress: done
pgpool[29578]: pool_set_query_in_progress: done
pgpool[29578]: do_command: Query: BEGIN
pgpool[29578]: wait_for_query_response: waiting for backend 1
completing the query
pgpool[29578]: detect_error: kind: C
pgpool[29578]: do_command: kind: C
pgpool[29578]: do_command: kind: Z
pgpool[29578]: do_command: transaction state: T
pgpool[29578]: pool_unset_writing_transaction: done
pgpool[29578]: Parse: waiting for master completing the query
pgpool[29578]: wait_for_query_response: waiting for backend 1
completing the query
pgpool[29578]: detect_error: kind: 1
pgpool[29578]: read_kind_from_backend: read kind from 1 th backend 1
NUM_BACKENDS: 2
pgpool[29578]: ProcessBackendResponse: kind from backend: 1
pgpool[29578]: pool_add_sent_message: prepared statement "" already exists
pgpool[29578]: can_query_context_destroy: query context is still used.
pgpool[29578]: pool_set_command_success: done
pgpool[29578]: pool_unset_query_in_progress: done
pgpool[29578]: ProcessFrontendResponse: kind from frontend B(42)
pgpool[29578]: pool_unset_doing_extended_query_message: done
pgpool[29578]: pool_set_doing_extended_query_message: done
pgpool[29578]: pool_set_query_in_progress: done
pgpool[29551]: reap_handler called
pgpool[29551]: reap_handler: call wait3
pgpool[29551]: Child process 29578 was terminated by segmentation fault
pgpool[29551]: child 29578 exits with status 139 by signal 11


アプリ側の状況としましては、

Parse: rewrite query   INSERT INTO "log"("id", "id2", "date", "type")
VALUES ($1,$2,"pg_catalog"."timestamptz"('2012-02-10
14:50:51.894755+09'::text),$3) len=182

のクエリー発行後に、

"SELECT "  "ID," "ID2," "DATE," "COUNT," "MM," "NN," "LL," "PARAMETER"
                        " FROM INFO" " WHERE ID3 = $1 "
                        " ORDER BY DATE DESC LIMIT 1";

を発行すると pgpool2 が segfault し、postgres 的 (PQresultStatus(res)) には FATAL
エラーが返ってきます。


以上のような状況なのですが、どなたか回避策などご存知でしたらお願い致します。

pgpool2 を設定するのは実は初めてなのですが、
発行する SQL 的な制約など何かありましたらご教示頂けますと助かります。
宜しくどうぞお願い致します。

斉藤


pgpool-general-jp メーリングリストの案内