Ticket 3582 - syslog() changes errno on FreeBSD which causes slurmdbd commands to fail
Summary: syslog() changes errno on FreeBSD which causes slurmdbd commands to fail
Status: RESOLVED FIXED
Alias: None
Product: Slurm
Classification: Unclassified
Component: Contributions (show other tickets)
Version: 17.02.1
Hardware: Other Other
: 4 - Minor Issue
Assignee: Moe Jette
QA Contact:
URL:
Depends on:
Blocks:
 
Reported: 2017-03-15 07:07 MDT by Yair Yarom
Modified: 2017-12-15 11:18 MST (History)
0 users

See Also:
Site: -Other-
Slinky Site: ---
Alineos Sites: ---
Atos/Eviden Sites: ---
Confidential Site: ---
Coreweave sites: ---
Cray Sites: ---
DS9 clusters: ---
Google sites: ---
HPCnow Sites: ---
HPE Sites: ---
IBM Sites: ---
NOAA SIte: ---
NoveTech Sites: ---
Nvidia HWinf-CS Sites: ---
OCF Sites: ---
Recursion Pharma Sites: ---
SFW Sites: ---
SNIC sites: ---
Tzag Elita 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 (805 bytes, patch)
2017-03-15 07:07 MDT, Yair Yarom
Details | Diff

Note You need to log in before you can comment on or make changes to this ticket.
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