[asterisk-bugs] [Asterisk 0014831]: Issue starting Asterisk with LinuxHA

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Apr 29 03:11:43 CDT 2009


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=14831 
====================================================================== 
Reported By:                chris-mac
Assigned To:                tilghman
====================================================================== 
Project:                    Asterisk
Issue ID:                   14831
Category:                   Resources/res_musiconhold
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     ready for testing
Asterisk Version:           SVN 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): 1.6.1 
SVN Revision (number only!): 186527 
Request Review:              
====================================================================== 
Date Submitted:             2009-04-05 11:22 CDT
Last Modified:              2009-04-29 03:11 CDT
====================================================================== 
Summary:                    Issue starting Asterisk with LinuxHA
Description: 
Just noticed strange behaviour of Music on Hold.

When I start asterisk for the first time (after the server was powered
on), and try to put a SIP call on hold, console shows:

DEBUG[5845]: res_musiconhold.c:726 get_mohbyname: Music on Hold class
'default' not found in memory

the following CLI command shows nothing:
asterisk -r -x "moh show classes"

Only after asterisk is restarted MoH works OK, and 'asterisk -r -x "moh
show classes"' shows:
--------------------
Class: default
	Mode: files
	Directory: /var/lib/asterisk/moh
--------------------

My musiconhold.conf:
----------------
[general]
cachertclasses=yes

[default]
mode=files
directory=/var/lib/asterisk/moh
----------------

Already tried with cachertclasses=yes/no with the same result.

Best regards,
Chris
====================================================================== 

---------------------------------------------------------------------- 
 (0103915) chris-mac (reporter) - 2009-04-29 03:11
 http://bugs.digium.com/view.php?id=14831#c103915 
---------------------------------------------------------------------- 
Patch solves the MoH/LinuxHA issue, however in my opinion:

1. Summary of this bug should be changed to "Asterisk starting directory
should be '/', not CWD"

2. Patch should be modified, so it *always" sets "/" as a working
directory. Not only if the directory in which Asterisk is started is not
accessible (as it is the case now).

3. The reason for the above:

"Linux System Programming" - Robert Love
http://books.google.com/books?id=k_ocKY0iegsC&pg=PA159&dq=linux+daemon+programing&lr=#PPA159,M1
"Change the working directory to the root directory via chdir(). This is
done because inherited working directory can be anywhere on the filesystem.
Daemons tend to run for the duration of the system's uptime, and you don't
want to keep some randoms directory open, and thus prevent an administrator
from unmounting the filesystem containing that directory."

"Wikidepia - Daemon_(computer_software)"
http://en.wikipedia.org/wiki/Daemon_(computer_software)
"The common method for a process to become a daemon involves:
[...]Setting the root directory ("/") as the current working directory so
that the process will not keep any directory in use that may be on a
mounted file system (allowing it to be unmounted)."

"Linux Journal - Linux Network Programming, Part 2 - by Ivan Griffin and
John Nelson"
http://www.linuxjournal.com/article/2335
"[...]Daemons are typically started at boot-up and remain running
throughout the uptime life of the system. If a daemon was started from a
mounted file system, it would be impossible to unmount the file system
until the daemon was killed. As a result, it is a sensible daemon
programming practice to perform a chdir() to / (or perhaps to a file system
which holds files relevant to the operation of the daemon)."

Best regards,
Chris 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-04-29 03:11 chris-mac      Note Added: 0103915                          
======================================================================




More information about the asterisk-bugs mailing list