Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Mar 2026 00:52:10 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 294035] ctld can accumulate zombie children
Message-ID:  <bug-294035-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294035

            Bug ID: 294035
           Summary: ctld can accumulate zombie children
           Product: Base System
           Version: 15.0-STABLE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: ndenev@gmail.com

`ctld` can leave exited child processes in `<defunct>` state for a long time
even though the parent daemon remains alive and continues listening for new
connections.

It appears the SIGCHLD interrupts the kevent() but not the outer loop where the
child reaping happens, they can accumulate. This can be reproduced by
connecting to any port where ctld is listening, e.g. nvmeof discovery or iscsi.

I believe this should fix the issue by returning from main_loop() and having
wait_for_children() run:

```
diff --git a/usr.sbin/ctld/ctld.cc b/usr.sbin/ctld/ctld.cc
index 331c029e28..a6c80a3604 100644
--- a/usr.sbin/ctld/ctld.cc
+++ b/usr.sbin/ctld/ctld.cc
@@ -2418,7 +2418,7 @@ main_loop(bool dont_fork)
                        error = kevent(kqfd, NULL, 0, &kev, 1, NULL);
                        if (error == -1) {
                                if (errno == EINTR)
-                                       continue;
+                                       return;
                                log_err(1, "kevent");
                        }
```

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-294035-227>