[asterisk-dev] [Code Review] 4390: app_agent_pool: Fix initial module load agent device state reporting.

rmudgett reviewboard at asterisk.org
Fri Jan 30 11:45:03 CST 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4390/
-----------------------------------------------------------

(Updated Jan. 30, 2015, 11:45 a.m.)


Status
------

This change has been marked as submitted.


Review request for Asterisk Developers.


Changes
-------

Committed in revision 431492


Bugs: ASTERISK-24737
    https://issues.asterisk.org/jira/browse/ASTERISK-24737


Repository: Asterisk


Description
-------

When the app_agent_pool module initially loads there is a race condition
between the thread loading agents.conf and the device state internal
processing thread.  If the device state internal processing thread handles
the agent creation state updates before the thread that loaded agents.conf
registers the device state provider callback then the cached agent state
is "Invalid".  When a consumer module like app_queue asks for the agent state
it gets the cached "Invalid" state instead of the real state from the provider.

* Moved loading the agents.conf configuration to the last thing setup by
app_agent_pool in load_module().  Now the device state provider callback
is registered before the config is loaded so the agent creation state
updates are guaranteed to get the initial device state.

* Removed some now redundant config cleanup on error in load_config().

* Added lock protection when accessing the device state in
agent_pvt_devstate_get() and eliminated the RAII_VAR() usage.


Diffs
-----

  /branches/13/apps/app_agent_pool.c 431427 

Diff: https://reviewboard.asterisk.org/r/4390/diff/


Testing
-------

Without the patch, the initial agent state reported by app_queue is "Invalid".
With the patch, the initial agent state reported by app_queue is the expected "Unavailable" state.


Thanks,

rmudgett

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150130/0d7ba73d/attachment.html>


More information about the asterisk-dev mailing list