Thread

Commits

  1. Initialize ListenSocket array earlier.

  1. Logger process and "LOG: could not close client or listen socket: Bad file descriptor"

    Michael Paquier <michael@paquier.xyz> — 2023-08-28T00:52:09Z

    Hi all,
    (Heikki in CC.)
    
    After b0bea38705b2, I have noticed that the syslogger is generating a
    lot of dummy LOG entries:
    2023-08-28 09:40:52.565 JST [24554]
    LOG:  could not close client or listen socket: Bad file descriptor  
    
    The only reason why I have noticed this issue is because I enable the
    logging collector in my development scripts.  Note that the pg_ctl
    test 004_logrotate.pl, the only one with logging_collector set, is
    equally able to reproduce the issue.
    
    The root of the problem is ClosePostmasterPorts() in syslogger.c,
    where we close the postmaster ports, but all of them are still set at
    0, leading to these spurious logs.
    
    From what I can see, this is is a rather old issue, because
    ListenSocket[] is filled with PGINVALID_SOCKET *after* starting the
    syslogger.  It seems to me that we should just initialize the array
    before starting the syslogger, so as we don't get these incorrect
    logs?
    
    Thoughts?  Please see the attached.
    --
    Michael
    
  2. Re: Logger process and "LOG: could not close client or listen socket: Bad file descriptor"

    Peter Geoghegan <pg@bowt.ie> — 2023-08-29T03:18:22Z

    On Sun, Aug 27, 2023 at 5:52 PM Michael Paquier <michael@paquier.xyz> wrote:
    > From what I can see, this is is a rather old issue, because
    > ListenSocket[] is filled with PGINVALID_SOCKET *after* starting the
    > syslogger.  It seems to me that we should just initialize the array
    > before starting the syslogger, so as we don't get these incorrect
    > logs?
    >
    > Thoughts?  Please see the attached.
    
    Agreed, this is very annoying. I'm going to start using your patch
    with the feature branch I'm working on. Hopefully that won't be
    necessary for too much longer.
    
    
    -- 
    Peter Geoghegan
    
    
    
    
  3. Re: Logger process and "LOG: could not close client or listen socket: Bad file descriptor"

    Heikki Linnakangas <hlinnaka@iki.fi> — 2023-08-29T06:27:48Z

    On 29/08/2023 06:18, Peter Geoghegan wrote:
    > On Sun, Aug 27, 2023 at 5:52 PM Michael Paquier <michael@paquier.xyz> wrote:
    >>  From what I can see, this is is a rather old issue, because
    >> ListenSocket[] is filled with PGINVALID_SOCKET *after* starting the
    >> syslogger.  It seems to me that we should just initialize the array
    >> before starting the syslogger, so as we don't get these incorrect
    >> logs?
    >>
    >> Thoughts?  Please see the attached.
    > 
    > Agreed, this is very annoying. I'm going to start using your patch
    > with the feature branch I'm working on. Hopefully that won't be
    > necessary for too much longer.
    
    Just to close the loop on this thread: I committed and backpatched 
    Michael's fix.
    
    Discussion on other thread at 
    https://www.postgresql.org/message-id/9caed67f-f93e-5701-8c25-265a2b139ed0%40iki.fi.
    
    -- 
    Heikki Linnakangas
    Neon (https://neon.tech)
    
    
    
    
    
  4. Re: Logger process and "LOG: could not close client or listen socket: Bad file descriptor"

    Michael Paquier <michael@paquier.xyz> — 2023-08-29T06:30:46Z

    On Tue, Aug 29, 2023 at 09:27:48AM +0300, Heikki Linnakangas wrote:
    > Just to close the loop on this thread: I committed and backpatched Michael's
    > fix.
    
    Thanks!
    --
    Michael