Review Board 1.7.16


app_agent_pool: Fix initial module load agent device state reporting.

Review Request #4390 - Created Jan. 29, 2015 and submitted

rmudgett
13
ASTERISK-24737
Reviewers
asterisk-dev
Asterisk
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.
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.
Review request changed
Updated (Jan. 30, 2015, 12:23 p.m.)
  • changed from pending to submitted
Committed in revision 431509

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.