🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.bugs
2 messages
2 total messages Started by bugzilla-noreply Thu, 19 Nov 2026 05:17
[Bug 300887] syslog(3) messages lost when sender calls closelog() right after syslog() and several senders log at once (cron CMD...
#531
Author: bugzilla-noreply
Date: Thu, 19 Nov 2026 05:17
85 lines
5396 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300887

            Bug ID: 300887
           Summary: syslog(3) messages lost when sender calls closelog()
                    right after syslog() and several senders log at once
                    (cron CMD lines missing in /var/log/cron since 15.1)
           Product: Base System
           Version: 15.1-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: knezour@weboutsourcing.cz

After upgrading a machine from 14.4-RELEASE to 15.1-RELEASE-p7 (amd64),
/var/log/cron no longer contains a CMD line for every job when several jobs
start in the same minute. The jobs themselves run; only the log lines are
missing. A second machine on 15.1-RELEASE-p5 shows the same pattern.

Observed:
- Machine 1 (15.1-RELEASE-p7): three "* * * * *" jobs. On 14.4: 60 CMD lines
  per job per hour. On 15.1: 2 or 3 lines per minute instead of 3. The loss
  was reproduced here with the test below.
- Machine 2 (15.1-RELEASE-p5, default /etc/crontab only: atrun */5,
  save-entropy */11, newsyslog hourly): complete logs for two weeks before the
  upgrade (288 atrun lines per day). In the 3.5 days after the upgrade 58 atrun
  lines are missing, 57 of them at minute 00 or 55, i.e. exactly when atrun
  starts together with newsyslog or save-entropy. Not reproduced by a test
  there, log analysis only.
- A third machine (15.1-RELEASE-p5, same default crontab) lost
  only one atrun line in the same period, so the race is timing dependent.
- No "last message repeated" lines, syslogd runs with default flags (-s),
  default syslog.conf.

Analysis:
- cron's grandchild calls log_it(..., "CMD", ...) and immediately closelog()
  (usr.sbin/cron/cron/do_command.c). libc syslog(3) uses a connected
  SOCK_DGRAM socket.
- unp_disconnect() in sys/kern/uipc_usrreq.c moves the datagrams still sitting
in
  the sender's send buffer to the receiver only if the receiver's own buffer is
  empty; otherwise it frees them ("protection against a scenario where a peer
  connects, floods and disconnects").
- So if two or several processes do syslog(); closelog(); before syslogd has
read
  the first datagram, only the first message survives.
- This code is the same in 14.4, as are cron and libc syslog.c; what changed is
  syslogd (kevent loop, Capsicum/casper). Presumably syslogd on 14.4 drained
the
  socket fast enough for the race not to show.

How to reproduce (15.1-RELEASE, any program using libc syslog; here PHP CLI):

php -r 'for ($i=1;$i<=3;$i++) { openlog("TESTcron", LOG_PID, LOG_CRON);
syslog(LOG_INFO, "TEST B message ".$i); closelog(); }'

Result: only "TEST B message 1" is written to /var/log/cron (4 runs: 4 of 12
messages logged, always the first one of each run).

Control 1: one message per process, one second apart: 4 of 4 logged.
Control 2: three messages over one connection, closelog() only at the end: 3 of
3 logged.

Expected: every message accepted by send(2) on the connected log socket is
delivered to syslogd, as on 14.4.

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

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 300887] syslog(3) messages lost when sender calls closelog() right after syslog() and several senders log at once (cron CMD...
#560
Author: bugzilla-noreply
Date: Thu, 19 Nov 2026 16:06
16 lines
2647 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300887

Mark Linimon <linimon@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |regression

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

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads