all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#55223: Shepherd 0.9.0 ‘make-inetd-constructor’ can leak file descriptors
@ 2022-05-02 14:52 Ludovic Courtès
  2022-05-02 21:11 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Ludovic Courtès @ 2022-05-02 14:52 UTC (permalink / raw)
  To: 55223

‘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’.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-02 21:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-02 14:52 bug#55223: Shepherd 0.9.0 ‘make-inetd-constructor’ can leak file descriptors Ludovic Courtès
2022-05-02 21:11 ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.