Обсуждение: Fix a possible socket leak at Windows (src/backend/port/win32/socket.c)

Поиск
Список
Период
Сортировка

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

От
Ranier Vilela
Дата:
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

Вложения

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

От
Daniel Gustafsson
Дата:
> 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
cannotbe 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




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

От
Ranier Vilela
Дата:
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

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

От
Michael Paquier
Дата:
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

Вложения

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

От
Daniel Gustafsson
Дата:
> 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




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

От
Ranier Vilela
Дата:


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