https://bugs.openldap.org/show_bug.cgi?id=10361
Issue ID: 10361 Summary: lapo-auditlog: Add olcAuditLogNonBlocking to avoid blocking when logging to named pipes Product: OpenLDAP Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: overlays Assignee: bugs@openldap.org Reporter: a.cudbardb@freeradius.org Target Milestone: ---
Created attachment 1081 --> https://bugs.openldap.org/attachment.cgi?id=1081&action=edit Patch adding olcAuditlogNonBlocking and a tests for slapo-auditlog
The default behaviour of fopen() when called on a named pipe which does not have any reader, is to block, until a reader opens the pipe. This in turn blocks slapo-auditlog when it attempts to write output, and prevents slapd processing requests. Depending on how critical the audit log is, it may be preferable to discard audit log output and continue processing requests if there's no reader available which olcAuditLogNonBlocking: TRUE allows.
For clarity the call to fopen() is removed and replaced with open()/fdopen(), allowing us to specify O_* flags as opposed to using fopen() OR open()/fdopen() depending on whether we should block. 0666 are the base permissions used by fopen() when files are created.
There were no tests for slapo-auditlog, so a small test suite that tests both the basic behaviour, and blocking/non-blocking writes.
https://bugs.openldap.org/show_bug.cgi?id=10361
--- Comment #1 from a.cudbardb@freeradius.org a.cudbardb@freeradius.org --- *a small test suite that tests both the basic behaviour, and blocking/non-blocking writes is provided.
https://bugs.openldap.org/show_bug.cgi?id=10361
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Assignee|bugs@openldap.org |hyc@openldap.org Target Milestone|--- |2.7.0 Keywords|needs_review |
https://bugs.openldap.org/show_bug.cgi?id=10361
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |TEST
--- Comment #2 from Quanah Gibson-Mount quanah@openldap.org --- main:
• 163da8d2 by Arran Cudbard-Bell at 2025-07-03T11:18:51-06:00 slapo-auditlog: Add olcAuditlogNonBlocking to avoid blocking when logging to named pipes
https://bugs.openldap.org/show_bug.cgi?id=10361
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|lapo-auditlog: Add |slapo-auditlog: Add |olcAuditLogNonBlocking to |olcAuditLogNonBlocking to |avoid blocking when logging |avoid blocking when logging |to named pipes |to named pipes
--- Comment #3 from Quanah Gibson-Mount quanah@openldap.org --- Possibly this commit too:
main:
• b6bed508 by Arran Cudbard-Bell at 2025-07-01T07:57:59-04:00 build: Set OS_WINDOWS in `scripts/defines.sh` to aid with Windows detection in test cases
This uses the result AC_CANONICAL_HOST and a pre-existing case statement checking for mingw32, cygwin, interix to determine if the build system is Windows based... We make the not unreasonable assumption that if the build system is Windows based, the tests will also be running on a Windows system.
https://bugs.openldap.org/show_bug.cgi?id=10361
--- Comment #4 from Quanah Gibson-Mount quanah@openldap.org --- • 216562d1 by Howard Chu at 2025-07-28T15:22:57+01:00 ITS#10361 slapo-auditlog (empty commit)
Note that 163da8d21762f11b10d891d39e8ff0a7b459e55b and b6bed508f5202e01018615dce96dac06fcd8784b were for this ITS#. Those commit messages didn't include the required ITS#.
https://bugs.openldap.org/show_bug.cgi?id=10361
--- Comment #5 from Howard Chu hyc@openldap.org --- O_NONBLOCK is undefined on my Windows MSYS2 build.