🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #7377

Bug#1156289: cron: orphan list grows over time, leading to excessive nss requests

#7377
From: Willow Carlson-Huber
Date: Thu, 03 Dec 2026 21:00
77 lines
4021 bytes
This is a multi-part MIME message sent by reportbug.


--===============5741196006712082478==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: cron
Version: 3.0pl1-200ubuntu1
Severity: normal
Tags: patch
X-Debbugs-Cc: willow.carlsonhuber@canonical.com

Dear Maintainer,

When orphaned crontabs exist, cron adds them to the orphans list without checking if they are already present. When the list grows sufficiently large, it can cause delayed jobs and excessive nss requests. The attached patch adds a check for whether an entry is already present in the list before adding it, which prevents the list from growing over time.

--===============5741196006712082478==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="prevent-duplicate-orphans.patch"

Origin: vendor, https://git.almalinux.org/rpms/cronie/src/commit/847f386cc7baa45e9eec46fe2c294a838922a9de/cronie-1.4.12-refresh-users.patch
Reviewed-by: Willow Carlson-Huber <willow.carlsonhuber@canonical.com>
Description: Prevent adding duplicate orphans to the orphans list.
 Previously, the orphans list would grow whenever the database reloaded while orphans were present, eventually resulting in cron hammering nss-systemd with requests and delaying jobs.
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/cron/+bug/2174449

--- a/database.c
+++ b/database.c
@@ -617,10 +617,41 @@
 	}
 }
 
+static int
+find_orphan(const char *uname, const char *fname, const char *tabname) {
+	orphan *o;
+
+	for (o = orphans; o != NULL; o = o->next) {
+		if (uname && o->uname) {
+			if (strcmp(uname, o->uname) != 0)
+				continue;
+		} else if (uname != o->uname)
+			continue;
+
+		if (fname && o->fname) {
+			if (strcmp(fname, o->fname) != 0)
+				continue;
+		} else if (fname != o->fname)
+			continue;
+
+		if (tabname && o->tabname) {
+			if (strcmp(tabname, o->tabname) != 0)
+				continue;
+		} else if (tabname != o->tabname)
+			continue;
+		return 1;
+	}
+
+	return 0;
+}
+
 static void
 add_orphan(const char *uname, const char *fname, const char *tabname) {
 	orphan *o;
 
+	if (find_orphan(uname, fname, tabname))
+		return;
+
 	o = calloc(1, sizeof(*o));
 	if (o == NULL)
 		return;

--===============5741196006712082478==--
Technical Details
Message-ID: <O6m4h-fO1B-3@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-ams.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-ams.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Willow Carlson-Huber <willow.carlsonhuber@canonical.com>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1156289: cron: orphan list grows over time, leading to excessive nss requests
Date: Thu, 03 Dec 2026 22:00:01 +0100
Message-ID: <O6m4h-fO1B-3@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Thu Dec  3 20:51:09 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.651
Reply-To: Willow Carlson-Huber <willow.carlsonhuber@canonical.com>, 1156289@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: willow.carlsonhuber@canonical.com, georgesk@debian.org
X-Debian-Pr-Message: report 1156289
X-Debian-Pr-Package: cron
X-Debian-Pr-Keywords: patch
X-Debian-Pr-Source: cron
Content-Type: multipart/mixed; boundary="===============5741196006712082478=="
MIME-Version: 1.0
X-Mailer: reportbug 13.2.0+ubuntu1
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2006821
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 77
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Thu, 03 Dec 2026 14:48:57 -0600
X-Original-Message-ID: <179633093724.468346.11588913044061501776.reportbug@willow-workbuntu>