[asterisk-bugs] [Asterisk 0014461]: [patch] func_devstate not updating Custom hints, and not in sync with ASTDB

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Feb 13 04:09:17 CST 2009


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=14461 
====================================================================== 
Reported By:                alecdavis
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   14461
Category:                   Functions/func_devstate
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           SVN 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!): 174327 
Request Review:              
====================================================================== 
Date Submitted:             2009-02-11 22:53 CST
Last Modified:              2009-02-13 04:09 CST
====================================================================== 
Summary:                    [patch] func_devstate not updating Custom hints, and
not in sync with ASTDB
Description: 
astdb is always being updated, but sometimes hints are not.
It's not consistant, as I type this bug, it will come right and work
correctly for a while, then go wrong.

astrid*CLI> database show CustomDevstate
...
/CustomDevstate/q8501_a8512                       : INUSE
...

astrid*CLI> core show hints
            8501GXP0001 at BLF_Group_1         : Custom:q8501_a8512   
State:Idle            Watchers  1

further manipulation from the command line.

astrid*CLI> devstate change Custom:q8501_a8512 NOT_INUSE
Changing q8501_a8512 to NOT_INUSE
  == Extension Changed 8501GXP0001[BLF_Group_1] new state InUse for Notify
User GXP0001

astrid*CLI> devstate change Custom:q8501_a8512 INUSE
Changing q8501_a8512 to INUSE
  == Extension Changed 8501GXP0001[BLF_Group_1] new state Idle for Notify
User GXP0001

But the weirdest thing, the BLF lamp on the phone comes right after approx
35 seconds, but still the Hint is incorrect.



====================================================================== 

---------------------------------------------------------------------- 
 (0100086) alecdavis (reporter) - 2009-02-13 04:09
 http://bugs.digium.com/view.php?id=14461#c100086 
---------------------------------------------------------------------- 
please remove bug14461.diff.txt
uploaded bug14461.diff2.txt

I think this is as far as I can get.

The problem is that 'main/devicestate.c:_ast_device_state' returns the
cached CustomDevice state, there's a race condition, the cache is not being
updated fast enough.

Sometimes the cache is queried by '_ast_device_state' before it's
updated.

The cache is updated by ''main/devicestate.c:devstate_event' which is
called from 'ast_devstate_changed_literal', which has to be executed before
'_ast_device_state'.

SO. the workaround, is to not use the cache for Custom DeviceStates, and
let '_ast_device_state' get if from 'getproviderstate(provider, number)'

working console output with some extra debug:

[Feb 13 22:38:57] NOTICE[25204]: func_devstate.c:132 devstate_write:
DEVICE_STATE function state=1 for device q8501_a8520
[Feb 13 22:38:57] NOTICE[25204]: devicestate.c:584
ast_devstate_changed_literal: state=1 for device Custom:q8501_a8520
[Feb 13 22:38:57] NOTICE[25204]: devicestate.c:546 devstate_event: cache
state=1 for device Custom:q8501_a8520
[Feb 13 22:38:57] NOTICE[25174]: devicestate.c:346 _ast_device_state:
provider for "Custom" - number:=q8501_a8520 state=1
device=Custom:q8501_a8520
[Feb 13 22:38:57] NOTICE[25172]: devicestate.c:750 process_collection:
cache state=1 for device Custom:q8501_a8520 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-02-13 04:09 alecdavis      Note Added: 0100086                          
======================================================================




More information about the asterisk-bugs mailing list