Re: Use FD_CLOEXEC on ListenSockets (was Re: Refactoring backend fork+exec code)

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Tristan Partin <tristan(at)neon(dot)tech>, Peter Geoghegan <pg(at)bowt(dot)ie>
Subject: Re: Use FD_CLOEXEC on ListenSockets (was Re: Refactoring backend fork+exec code)
Date: 2023-10-06 07:27:22
Message-ID: 255a4e44-e5d9-2051-2c3f-242ff9b73429@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06/10/2023 09:50, Michael Paquier wrote:
> On Fri, Oct 06, 2023 at 02:30:16PM +0900, Michael Paquier wrote:
>> Okay, the backtrace is not that useful. I'll see if I can get
>> something better, still it seems like this has broken the way the
>> syslogger closes these ports.
>
> And here you go:
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0 GetMemoryChunkMethodID (pointer=0x0) at mcxt.c:196 196 header =
> *((const uint64 *) ((const char *) pointer - sizeof(uint64)));
> (gdb) bt
> #0 GetMemoryChunkMethodID (pointer=0x0) at mcxt.c:196
> #1 0x0000557d04176d59 in pfree (pointer=0x0) at mcxt.c:1463
> #2 0x0000557d03e8eab3 in ClosePostmasterPorts (am_syslogger=true) at postmaster.c:2571
> #3 0x0000557d03e93ac2 in SysLogger_Start () at syslogger.c:686
> #4 0x0000557d03e8c5b7 in PostmasterMain (argc=3, argv=0x557d0471ed00)
> at postmaster.c:1148
> #5 0x0000557d03d48e34 in main (argc=3, argv=0x557d0471ed00) at main.c:198
> (gdb) up 2
> #2 0x0000557d03e8eab3 in ClosePostmasterPorts (am_syslogger=true) at
> postmaster.c:2571
> 2571 pfree(ListenSockets);
> (gdb) p ListenSockets $1 = (pgsocket *) 0x0

Fixed, thanks!

I did a quick test with syslogger enabled before committing, but didn't
notice the segfault. I missed it because syslogger gets restarted and
then it worked.

--
Heikki Linnakangas
Neon (https://neon.tech)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Maxim Orlov 2023-10-06 07:50:11 Re: should frontend tools use syncfs() ?
Previous Message Peter Eisentraut 2023-10-06 07:05:38 Re: How to update unicode mapping table?