[asterisk-bugs] [Asterisk 0012354]: [patch] Race condition in manager interface.

noreply at bugs.digium.com noreply at bugs.digium.com
Wed Apr 2 08:48:12 CDT 2008


The following issue has been SUBMITTED. 
====================================================================== 
http://bugs.digium.com/view.php?id=12354 
====================================================================== 
Reported By:                bamby
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   12354
Category:                   Core/ManagerInterface
Reproducibility:            random
Severity:                   major
Priority:                   normal
Status:                     new
Asterisk Version:           1.4.18 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             04-02-2008 08:48 CDT
Last Modified:              04-02-2008 08:48 CDT
====================================================================== 
Summary:                    [patch] Race condition in manager interface.
Description: 
I use the manager interface (not HTTP) to identify the state of the channel
and state changes are to be detected as soon as possible. However I
experienced strange random delays that could last for several seconds
especially if the system had small load.

I've made investigation of the issue and found a cause of the problem. An
events get reported via manager_event() function which appends the event to
event queue and tries to inform the manager session thread about new event.
Notification is done via pthread_kill(s->waiting_thread, SIGURG) call in
order to interrupt the poll() call in get_input() function. But the problem
is that the waiting_thread field has valid value only during the poll()
call. Immediately after the poll() the waiting_thread is cleared and stays
NULL until next poll(). So if an event comes at the instant when
waiting_thread is AST_PTHREAD_NULL then this event has a good chance to
stay unnoticed until next event or input from client.

I've added a field to the struct mansession that act as a pending event
indicator when the waiting_thread is NULL. This works pretty well for me.
====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
04-02-08 08:48  bamby          Asterisk Version          => 1.4.18          
04-02-08 08:48  bamby          SVN Branch (only for SVN checkou => N/A          
  
======================================================================




More information about the asterisk-bugs mailing list