Ticket 3582

Summary: syslog() changes errno on FreeBSD which causes slurmdbd commands to fail
Product: Slurm Reporter: Yair Yarom <irush>
Component: ContributionsAssignee: Moe Jette <jette>
Status: RESOLVED FIXED QA Contact:
Severity: 4 - Minor Issue    
Priority: ---    
Version: 17.02.1   
Hardware: Other   
OS: Other   
Site: -Other- Alineos Sites: ---
Atos/Eviden Sites: --- Confidential Site: ---
Coreweave sites: --- Cray Sites: ---
DS9 clusters: --- HPCnow Sites: ---
HPE Sites: --- IBM Sites: ---
NOAA SIte: --- OCF Sites: ---
Recursion Pharma Sites: --- SFW Sites: ---
SNIC sites: --- Linux Distro: ---
Machine Name: CLE Version:
Version Fixed: 17.11.1 Target Release: ---
DevPrio: --- Emory-Cloud Sites: ---
Attachments: Ignore syslog's errno on FreeBSD

Description Yair Yarom 2017-03-15 07:07:33 MDT
Created attachment 4206 [details]
Ignore syslog's errno on FreeBSD

Hello,

We're running our slurmdbd on a FreeBSD machine. There, syslog() changes errno to 13 (Permission denied) which causes slurmdbd commands to fail when debugging level is high (and slurmdbd is daemonized). e.g.:

$ sacct
       JobID    JobName  Partition    Account  AllocCPUS      State ExitCode 
------------ ---------- ---------- ---------- ---------- ---------- -------- 
sacct: error: Permission denied
$ 

The reason is that e.g. src/slurmdbd/proc_req.c:_get_jobs_cond checks errno's value without resetting it first.

Attached is a patch that ignores syslog's errno on FreeBSD.

Best Regards,
    Yair.


P.S. I do consider this also a FreeBSD bug (which happens because syslog() tries to open /var/run/logpriv and fails on permission denied). However, one can claim that the proper way is to check errno after each library call anyway, and not after several calls (which this patch doesn't do...).
Comment 1 Moe Jette 2017-12-15 11:18:59 MST
Thank you for your contribution.

A slightly modified version of your patch been committed to Slurm version 17.11.1. Here is the commit:
https://github.com/SchedMD/slurm/commit/148185fb535ec002a9ba0e52bf3d237061719b92