[May be a bug] double free or corruption

From: Wen Yi <wen-yi(at)qq(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [May be a bug] double free or corruption
Date: 2023-07-26 14:24:11
Message-ID: tencent_3EE30CDDB4A5595C66EB9C56034CE5205D09@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi community,
I use the PostgreSQL 17devel on x86_64-pc-linux-gnu, compiled by gcc (GCC) 13.1.1 20230614 (Red Hat 13.1.1-4), 64-bit.(Fedora Linux)
And I use the gdb to debug the postgres, just test the pg_ctl.
As you can see:

-----------------------------------------------------------------------------------------------------------------------------------

[Switching to Thread 0x7ffff7dce740 (LWP 83554)]
start_postmaster () at pg_ctl.c:455
455&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (pm_pid < 0)
(gdb) ..
462&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (pm_pid &gt; 0)
(gdb) ................
476&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (setsid() < 0)
(gdb) ..
489&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (log_file != NULL)
(gdb)
490&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cmd = psprintf("exec \"%s\" %s%s < \"%s\" &gt;&gt; \"%s\" 2&gt;&amp;1",
(gdb) ..
497&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (void) execl("/bin/sh", "/bin/sh", "-c", cmd, (char *) NULL);
(gdb) .
process 83554 is executing new program: /usr/bin/bash
Error in re-setting breakpoint 1: No source file named /home/postgres/project/postgres/src/devel/src/bin/pg_ctl/pg_ctl.c.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
Using host libthread_db library "/lib64/libthread_db.so.1".
process 83554 is executing new program: /home/postgres/postgres/bin/bin/postgres
[Thread debugging using libthread_db enabled]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
Using host libthread_db library "/lib64/libthread_db.so.1".
BFD: warning: /home/postgres/.cache/debuginfod_client/d25eaf3596d9455fe9725f6e9cd1aa5433f31b92/debuginfo has a section extending past end of file&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
Error while reading shared library symbols for /lib64/libstdc++.so.6:
`/home/postgres/.cache/debuginfod_client/d25eaf3596d9455fe9725f6e9cd1aa5433f31b92/debuginfo': can't read symbols: file format not recognized.
.[Attaching after Thread 0x7ffff7e8d480 (LWP 83554) fork to child process 83559]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
[New inferior 3 (process 83559)]
[Detaching after fork from parent process 83554]
[Inferior 2 (process 83554) detached]
double free or corruption (out)

Fatal signal: Aborted
----- Backtrace -----
corrupted double-linked list

Fatal signal: Aborted
----- Backtrace -----
&nbsp;done
server started
0x5557bf5908b0 ???
0x5557bf6cb4cd ???
0x7f040125fb6f ???
0x7f04012b0844 ???
0x7f040125fabd ???
0x7f040124887e ???
0x7f040124960e ???
0x7f04012ba774 ???
0x7f04012bc93f ???
0x7f04012bf1cd ???
0x5557bf98272a ???
0x5557bf7eb93c ???
0x5557bf643b48 ???
0x5557bf643d11 ???
0x7f04012b3af2 ???
0x5557bfc37d48 ???
0x7f04014e31f2 ???
0x7f04012ae906 ???
0x7f040133486f ???
0xffffffffffffffff ???
---------------------
A fatal error internal to GDB has been detected, further
debugging is not possible.&nbsp; GDB will now terminate.

This is a bug, please report it.&nbsp; For instructions, see:
<https://www.gnu.org/software/gdb/bugs/&gt;.

Aborted (core dumped)
[postgres(at)fedora postgres]$

--------------------------------------------------------------------------------------------------------------

As you can see, the gdb tell me I should report this, because gdb think there's a double-free.
But I check the postgres, it keep the run rightly, like this:(Before I run the psql, I print the log file)

-------------------------------------------------------------------------------------------------------------

2023-07-26 22:16:17.489 CST [83554] LOG:&nbsp; database system is ready to accept connections
[postgres(at)fedora postgres]$ psql
psql (17devel)
Type "help" for help.

postgres=# \q
[postgres(at)fedora postgres]$

--------------------------------------------------------------------------------------------------------------

Can someone notice this problem?
Thanks in advance

Yours,
Wen Yi

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message 油屋 2023-07-26 14:25:48 Re: Question about use_physical_tlist() which is applied on Scan path
Previous Message Aleksander Alekseev 2023-07-26 14:11:35 Re: POC: Extension for adding distributed tracing - pg_tracing