[pgpool-general: 9066] Re: Segmentation after switchover

Tatsuo Ishii ishii at sraoss.co.jp
Wed Apr 3 19:13:13 JST 2024


> I ran pgpool with valgrind and got some interesting results you might want
> to take a look at. Not only did it report an invalid read at the time of
> the segmentation vault, but it also reported quite a few locations where
> uninitialized values are being used. I've attached the log. The SIGSEGV is
> at timestamp 2024-04-02T23:11:11.254668098Z.

I have looked into the log and found a bug which caused the
uninitialized value error:

{"log":"==43==    by 0x1B2CEE: pstrdup (mcxt.c:1087)\n","stream":"stderr","time":"2024-04-02T23:05:14.004146358Z"}
{"log":"==43==    by 0x153658: read_startup_packet (child.c:772)\n","stream":"stderr","time":"2024-04-02T23:05:14.004148

> 772                 sp->database = pstrdup(sp->user);

This is caused by following line:

> 746                         sp->user = palloc(1);

Since palloc allocates uninitialized memory, subsequent pstrdup
failed.  Line 746 should have been:

746                         sp->user = palloc0(1);

Attached is the patch for this.

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uninitialized.patch
Type: text/x-patch
Size: 778 bytes
Desc: not available
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20240403/021c846c/attachment.bin>


More information about the pgpool-general mailing list