[asterisk-bugs] [JIRA] (ASTERISK-23383) Wrong sense test on stat return code causes unchanged config check to break with include files.

David Woolley (JIRA) noreply at issues.asterisk.org
Thu Feb 27 07:10:04 CST 2014


    [ https://issues.asterisk.org/jira/browse/ASTERISK-23383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=215698#comment-215698 ] 

David Woolley commented on ASTERISK-23383:
------------------------------------------

Note.  The gdb debugging, on the old version, that led us to this indicates that, at least for the top level configuration file, the mtime field does get set, but the first time the code processes an include file in the parsing mode, rather than change checking mode, and calls config_cache_attribue, the bad code clears out the value.  (It doesn't actually process includes in change checking mode, as the the top level file always has a zero cached mtime, at that point.)
                
> Wrong sense test on stat return code causes unchanged config check to break with include files.
> -----------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-23383
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-23383
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/Configuration
>    Affects Versions: SVN, 1.8.25.0
>         Environment: CentOS, although not really environment specific.
>            Reporter: David Woolley
>            Severity: Minor
>
> Whilst trying to understand why an old version (1.6.1.0) was not treating configuration files as unchanged during a reload if there were include files, we discovered the equivalent of the following code, which clearly has the wrong sense test on the result of stat.  This quote has been taken from the trunk version, but it has remained unchanged since the 1.8 branch version, and differs only in the use of direct assignments before that.
> In config_cache_attribute in main/config.c
> [quote]
>        if (!stat(configfile, &statbuf)) {
>                cfmstat_clear(cfmtime);
>        } else {
>                cfmstat_save(cfmtime, &statbuf);
>        }
> [quote]
> Whilst I still haven't worked out why the including files cfmtime needs updating here at all, the test is clearly wrong, as it only uses the stat result when it is invalid!
> The main consequence of this, other than wasted processing, as the result of doing full reloads on unchanged files, is that queue statistics get reset on a null reload.  However we are also investigating a possible race in the queue statistics update, which may or may not still be current.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list