Thread

Commits

  1. Close socket in case of errors in setting non-blocking

  1. Fix a possible socket leak at Windows (src/backend/port/win32/socket.c)

    Ranier Vilela <ranier.vf@gmail.com> — 2024-01-13T21:38:13Z

    Hi.
    
    While there are plans to remove the sockets functions (Windows) [1], I
    believe it is worth fixing possible current bugs.
    
    In the pgwin32_socket function (src/backend/port/win32/socket.c), there is
    a possible socket leak if the socket cannot be made non-blocking.
    
    Trivial patch attached.
    
    Best regards,
    Ranier Vilela
    
    [1] Re: Windows sockets (select missing events?)
    <https://www.postgresql.org/message-id/CA%2BhUKGKSLgxFhSP8%2BdqQqHsuZvrRRU3wZ6ytLOcno-mdGvckHg%40mail.gmail.com>
    
  2. Re: Fix a possible socket leak at Windows (src/backend/port/win32/socket.c)

    Daniel Gustafsson <daniel@yesql.se> — 2024-01-15T12:43:03Z

    > On 13 Jan 2024, at 22:38, Ranier Vilela <ranier.vf@gmail.com> wrote:
    
    > In the pgwin32_socket function (src/backend/port/win32/socket.c), there is a possible socket leak if the socket cannot be made non-blocking.
    
    I don't know Windows well enough to comment on the implications of not calling
    closesocket here, but it definitely seems like a prudent thing to do
    backpatched down to 12. Unless objections I'll do that.
    
    --
    Daniel Gustafsson
    
    
    
    
    
  3. Re: Fix a possible socket leak at Windows (src/backend/port/win32/socket.c)

    Ranier Vilela <ranier.vf@gmail.com> — 2024-01-16T20:25:39Z

    Em seg., 15 de jan. de 2024 às 09:43, Daniel Gustafsson <daniel@yesql.se>
    escreveu:
    
    > > On 13 Jan 2024, at 22:38, Ranier Vilela <ranier.vf@gmail.com> wrote:
    >
    > > In the pgwin32_socket function (src/backend/port/win32/socket.c), there
    > is a possible socket leak if the socket cannot be made non-blocking.
    >
    > I don't know Windows well enough to comment on the implications of not
    > calling
    > closesocket here, but it definitely seems like a prudent thing to do
    > backpatched down to 12. Unless objections I'll do that.
    >
    Thanks for taking care of this.
    Do you have plans or should I register for a commitfest?
    
    Best regards,
    Ranier Vilela
    
  4. Re: Fix a possible socket leak at Windows (src/backend/port/win32/socket.c)

    Michael Paquier <michael@paquier.xyz> — 2024-01-17T06:26:59Z

    On Tue, Jan 16, 2024 at 05:25:39PM -0300, Ranier Vilela wrote:
    > Thanks for taking care of this.
    
    Yeah, that's a good catch.
    
    > Do you have plans or should I register for a commitfest?
    
    Daniel has stated that he would take care of it, so why not letting
    him a few days?  I don't think that a CF entry is necessary.
    --
    Michael
    
  5. Re: Fix a possible socket leak at Windows (src/backend/port/win32/socket.c)

    Daniel Gustafsson <daniel@yesql.se> — 2024-01-17T12:53:59Z

    > On 17 Jan 2024, at 07:26, Michael Paquier <michael@paquier.xyz> wrote:
    > On Tue, Jan 16, 2024 at 05:25:39PM -0300, Ranier Vilela wrote:
    
    >> Do you have plans or should I register for a commitfest?
    > 
    > Daniel has stated that he would take care of it, so why not letting
    > him a few days?  I don't think that a CF entry is necessary.
    
    It isn't, I've now committed it backpatched down to 12.
    
    --
    Daniel Gustafsson
    
    
    
    
    
  6. Re: Fix a possible socket leak at Windows (src/backend/port/win32/socket.c)

    Ranier Vilela <ranier.vf@gmail.com> — 2024-01-17T15:28:28Z

    Em qua., 17 de jan. de 2024 09:54, Daniel Gustafsson <daniel@yesql.se>
    escreveu:
    
    > > On 17 Jan 2024, at 07:26, Michael Paquier <michael@paquier.xyz> wrote:
    > > On Tue, Jan 16, 2024 at 05:25:39PM -0300, Ranier Vilela wrote:
    >
    > >> Do you have plans or should I register for a commitfest?
    > >
    > > Daniel has stated that he would take care of it, so why not letting
    > > him a few days?  I don't think that a CF entry is necessary.
    >
    > It isn't, I've now committed it backpatched down to 12.
    >
    Thanks for the commit, Daniel.
    
    Best regards,
    Ranier Vilela