Re: BUG #18974: Postgresql repeatable crash after pg_upgrade from 15 to 17.5 version in postgresql_fdw queries

From: Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>
To: maxim(dot)boguk(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18974: Postgresql repeatable crash after pg_upgrade from 15 to 17.5 version in postgresql_fdw queries
Date: 2025-07-02 06:35:21
Message-ID: CAK-MWwRyND1W1-t=EaLmpgkXYCr8G7qtinqHpTv_GK6t+Ykj+A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Jul 2, 2025 at 3:03 AM Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com> wrote:

>
>
> On Wed, Jul 2, 2025 at 1:09 AM PG Bug reporting form <
> noreply(at)postgresql(dot)org> wrote:
>
>> The following bug has been logged on the website:
>>
>> Bug reference: 18974
>> Logged by: Maxim Boguk
>> Email address: maxim(dot)boguk(at)gmail(dot)com
>> PostgreSQL version: 17.5
>> Operating system: Ubuntu
>> Description:
>>
>> Postgresql repeatable crash after pg_upgrade from 15 to 17.5 version in
>> postgresql_fdw timeouted (via query_timeout) queries
>> Backtrace data from core file:
>> Core was generated by `postgres: 17/main: **.app **_data [local] SELECT
>> '.
>> Program terminated with signal SIGSEGV, Segmentation fault.
>> #0 __strcmp_evex () at ../sysdeps/x86_64/multiarch/strcmp-evex.S:314
>> warning: 314 ../sysdeps/x86_64/multiarch/strcmp-evex.S: No such file or
>> directory
>> (gdb) bt
>> #0 __strcmp_evex () at ../sysdeps/x86_64/multiarch/strcmp-evex.S:314
>> #1 0x0000780820fd2df7 in emitHostIdentityInfo (conn=0x5d89b19f6d80,
>> host_addr=0x7ffd34c50c70 "10.100.103.4") at
>>
>
> (gdb) print ((PGconn *)0x5d89b19f6d80)->connhost[0]
> $14 = {type = CHT_HOST_NAME, host = 0x0, hostaddr = 0x5d89b19c53b0
> "10.100.103.4", port = 0x5d89b19c5390 "6503", password = 0x0}
> As a result displayed_host = conn
> <https://doxygen.postgresql.org/streamutil_8c.html#af4516154f33e07be1eadff88fab71465>
> ->connhost
> <https://doxygen.postgresql.org/structpg__conn.html#af613581f3bb3ef9a64acf0346c3cd92b>
> [conn
> <https://doxygen.postgresql.org/streamutil_8c.html#af4516154f33e07be1eadff88fab71465>
> ->whichhost
> <https://doxygen.postgresql.org/structpg__conn.html#aef258b7f6a1d241b2fad5728aa08a1ef>
> ].host
> <https://doxygen.postgresql.org/structpg__conn__host.html#a112de1e777da00724075fe6f65aaf3be> =
> 0x0
> and crash in line strcmp(displayed_host, host_addr) != 0
>
> related FDW definition:
> FDW options | ( dbname '****', hostaddr '10.100.103.4', port
> '6503')
>

related part of backtrace:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 __strcmp_evex () at ../sysdeps/x86_64/multiarch/strcmp-evex.S:314

(gdb) bt
#0 __strcmp_evex () at ../sysdeps/x86_64/multiarch/strcmp-evex.S:314
#1 0x0000780820fd2df7 in emitHostIdentityInfo (conn=0x5d89b19f6d80,
host_addr=0x7ffd34c50c70 "10.100.103.4") at
/usr/src/postgresql-17-17.5-1.pgdg24.04+1/build/../src/interfaces/libpq/fe-connect.c:2128
#2 0x0000780820fd8a0f in PQconnectPoll (conn=conn(at)entry=0x5d89b19f6d80) at
/usr/src/postgresql-17-17.5-1.pgdg24.04+1/build/../src/interfaces/libpq/fe-connect.c:3038
#3 0x0000780820fda44d in pqConnectDBStart (conn=0x5d89b19f6d80) at
/usr/src/postgresql-17-17.5-1.pgdg24.04+1/build/../src/interfaces/libpq/fe-connect.c:2446
#4 0x0000780820fda4e2 in PQcancelStart
(cancelConn=cancelConn(at)entry=0x5d89b19f6d80)
at
/usr/src/postgresql-17-17.5-1.pgdg24.04+1/build/../src/interfaces/libpq/fe-cancel.c:198
#5 0x000078082102401d in libpqsrv_cancel (conn=conn(at)entry=0x5d89b1785870,
endtime=endtime(at)entry=804720445571683) at
/usr/src/postgresql-17-17.5-1.pgdg24.04+1/build/../src/include/libpq/libpq-be-fe-helpers.h:399

in libpqsrv_cancel conn have:
(gdb) print ((PGconn *)0x5d89b1785870)->connhost[0]
$14 = {type = CHT_HOST_ADDRESS, host = 0x0, hostaddr = 0x5d89b16cde00
"10.100.103.4", port = 0x5d89b16cddc0 "6503", password = 0x0}

new connection in PQcancelStart already have wrong type:
(gdb) print ((PGconn *)0x5d89b19f6d80)->connhost[0]
$15 = {type = CHT_HOST_NAME, host = 0x0, hostaddr = 0x5d89b19c53b0
"10.100.103.4", port = 0x5d89b19c5390 "6503", password = 0x0}

--
Maxim Boguk
Senior Postgresql DBA

Phone UA: +380 99 143 0000
Phone AU: +61 45 218 5678

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Maxim Boguk 2025-07-02 07:04:12 Re: BUG #18974: Postgresql repeatable crash after pg_upgrade from 15 to 17.5 version in postgresql_fdw queries
Previous Message Masahiko Sawada 2025-07-02 06:32:09 Re: Logical replication 'invalid memory alloc request size 1585837200' after upgrading to 17.5