emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#55223: closed (Shepherd 0.9.0 ‘make-inetd-constructor’ can leak file


From: GNU bug Tracking System
Subject: bug#55223: closed (Shepherd 0.9.0 ‘make-inetd-constructor’ can leak file descriptors)
Date: Mon, 02 May 2022 21:12:02 +0000

Your message dated Mon, 02 May 2022 23:11:45 +0200
with message-id <87h767r65q.fsf@gnu.org>
and subject line Re: bug#55223: Shepherd 0.9.0 ‘make-inetd-constructor’ can 
leak file descriptors
has caused the debbugs.gnu.org bug report #55223,
regarding Shepherd 0.9.0 ‘make-inetd-constructor’ can leak file descriptors
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
55223: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55223
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: Shepherd 0.9.0 ‘make-inetd-constructor’ can leak file descriptors Date: Mon, 02 May 2022 16:52:05 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
‘make-inetd-constructor’ creates a socket and then calls bind(2) on it.

--8<---------------cut here---------------start------------->8---
  (lambda args
    (let ((sock  (non-blocking-port
                  (socket (sockaddr:fam address) socket-style 0)))
          […])
      (setsockopt sock SOL_SOCKET SO_REUSEADDR 1)
      […]
      (bind sock address)
--8<---------------cut here---------------end--------------->8---

If bind(2) fails, for instance with EADDRINUSE, the socket it created is
leaked; it will be closed “eventually”, when GC runs, but that could
happen much later.

Solution is to use some sort of ‘unwind-protect’ and close it upon
exception.

Ludo’.



--- End Message ---
--- Begin Message --- Subject: Re: bug#55223: Shepherd 0.9.0 ‘make-inetd-constructor’ can leak file descriptors Date: Mon, 02 May 2022 23:11:45 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Ludovic Courtès <ludovic.courtes@inria.fr> skribis:

> ‘make-inetd-constructor’ creates a socket and then calls bind(2) on it.
>
>   (lambda args
>     (let ((sock  (non-blocking-port
>                   (socket (sockaddr:fam address) socket-style 0)))
>           […])
>       (setsockopt sock SOL_SOCKET SO_REUSEADDR 1)
>       […]
>       (bind sock address)
>
> If bind(2) fails, for instance with EADDRINUSE, the socket it created is
> leaked; it will be closed “eventually”, when GC runs, but that could
> happen much later.

Fixed in Shepherd commit b4a30a309f0e9451a671691b19fa7a5e1ef92b69.

Ludo’.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]