Bug#255207: asterisk: sched_setscheduler() fails, error is written to /dev/null and it silently exits

Russell Coker Russell Coker <russell@coker.com.au>, 255207@bugs.debian.org
Sun, 20 Jun 2004 00:32:00 +1000


Package: asterisk
Version: 1.0-1
Severity: normal

In the below strace output you can see that when sched_setscheduler() fails an
error message is written to file handle 1.  File handle 1 is a dup of file
handle 3, which was obtained from opening /dev/null.  So the error message
goes direct to /dev/null and is not sent to the log files under
/var/log/asterisk or syslog.

Firstly the error handling mechanism should be fixed, after it has made file
handles 0, 1, and 2 refer to /dev/null it should use syslog for all logging.

setsid()                                = 2560
chdir("/")                              = 0
open("/dev/null", O_RDWR)               = 3
fstat64(3, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
dup2(3, 0)                              = 0
dup2(3, 1)                              = 1
dup2(3, 2)                              = 2
close(3)                                = 0
unlink("/var/run/asterisk/asterisk.pid") = 0
open("/var/run/asterisk/asterisk.pid", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
getpid()                                = 2560
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40018000
write(3, "2560\n", 5)                   = 5
close(3)                                = 0
munmap(0x40018000, 4096)                = 0
unlink("/var/run/asterisk/asterisk.ctl") = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 3
bind(3, {sa_family=AF_FILE, path="/var/run/asterisk/asterisk.ctl"}, 110) = 0
listen(3, 2)                            = 0
mmap2(NULL, 8392704, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40207000
mprotect(0x40207000, 4096, PROT_NONE)   = 0
clone(child_stack=0x40a07b48, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|CLONE_DETACHED, parent_tidptr=0x40a07bf8, {entry_number:6, base_addr:0x40a07bb0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}, child_tidptr=0x40a07bf8) = 2561
rt_sigprocmask(SIG_BLOCK, [HUP INT PIPE TERM WINCH], NULL, 8) = 0
rt_sigaction(SIGURG, {0x80751b8, [URG], SA_RESTART}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {0x8075878, [INT], SA_RESTART}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTERM, {0x8075878, [TERM], SA_RESTART}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGHUP, {0x80751f0, [HUP], SA_RESTART}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGCHLD, {0x807523c, [CHLD], SA_RESTART}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
sched_setscheduler(0, SCHED_OTHER, { 0 }) = -1 EACCES (Permission denied)
time([1087655102])                      = 1087655102
open("/etc/localtime", O_RDONLY)        = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=785, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40a08000
read(4, "TZif\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\0\4\0"..., 4096) = 785
close(4)                                = 0
munmap(0x40a08000, 4096)                = 0
fstat64(1, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfffd20c) = -1 ENOTTY (Inappropriate ioctl for device)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40a08000
write(1, "Unable to set normal priority\n", 30) = 30
munmap(0x40a08000, 4096)                = 0
exit_group(1)                           = ?

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.7-se
Locale: LANG=C, LC_CTYPE=C

Versions of packages asterisk depends on:
ii  asterisk-sounds       1.0-1              Sound files for asterisk
ii  libasound2            1.0.5-1            Advanced Linux Sound Architecture 
ii  libc6                 2.3.2.ds1-13       GNU C Library: Shared libraries an
ii  libedit2              2.6.cvs.20020109-7 BSD editline and history libraries
ii  libexpat1             1.95.6-8           XML parsing C library - runtime li
ii  libgsm1               1.0.10-12          Shared libraries for GSM speech co
ii  libncurses5           5.4-4              Shared libraries for terminal hand
ii  libopenh323-1.12.2    1.12.2-4           H.323 aka VoIP library
ii  libpq3                7.4.3-1            Shared library libpq.so.3 for Post
ii  libpri1               0.5.2-1            Primary Rate ISDN specification li
ii  libpt-1.5.2           1.5.2-4            Portable Windows Library
ii  libssl0.9.7           0.9.7d-3           SSL shared libraries
ii  libtonezone1          1:0.8.1-1          tonezone library (runtime)
ii  unixodbc              2.2.4-9            ODBC tools libraries
ii  zlib1g                1:1.2.1.1-3        compression library - runtime

-- no debconf information