[asterisk-bugs] [Asterisk 0016570]: (local_queue_frame): Error obtaining mutex: Invalid argument (causes crash)

Asterisk Bug Tracker noreply at bugs.digium.com
Mon Feb 22 10:17:56 CST 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=16570 
====================================================================== 
Reported By:                kebl0155
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   16570
Category:                   Channels/chan_local
Reproducibility:            sometimes
Severity:                   crash
Priority:                   normal
Status:                     feedback
Asterisk Version:           1.6.2.0 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-01-08 10:43 CST
Last Modified:              2010-02-22 10:17 CST
====================================================================== 
Summary:                    (local_queue_frame): Error obtaining mutex: Invalid
argument (causes crash)
Description: 
Asterisk crashes (core dumped) with the following error messages:

[Jan  8 15:28:56] ERROR[9587]
/usr/src/asterisk-1.6.2.0/include/asterisk/lock.h: chan_local.c line 234
(local_queue_frame): Error obtaining mutex: Invalid argument
[Jan  8 15:28:56] ERROR[9587]
/usr/src/asterisk-1.6.2.0/include/asterisk/lock.h: chan_local.c line 659
(local_hangup): mutex '&p->lock' freed more times than we've locked!
[Jan  8 15:28:56] ERROR[9587]
/usr/src/asterisk-1.6.2.0/include/asterisk/lock.h: chan_local.c line 659
(local_hangup): Error releasing mutex: Invalid argument

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

---------------------------------------------------------------------- 
 (0118333) kebl0155 (reporter) - 2010-02-22 10:17
 https://issues.asterisk.org/view.php?id=16570#c118333 
---------------------------------------------------------------------- 
And again today.

I had a look through the code.  This is happening when local_hangup tries
to unlock the thing after the lock() fails in local_queue_frame at line
234.

I checked the lock documentation, and (excluding thread priority) the only
way Invalid argument can be thrown is if &p->lock hasn't been initialised
properly:

The pthread_mutex_lock(), pthread_mutex_trylock() and
pthread_mutex_unlock() functions may fail if:

[EINVAL]
    The value specified by mutex does not refer to an initialised mutex
object.

however we know the object was sucessfully unlocked a microsecond earlier.
 Something must be invalidating the object (or freeing it?) during this
microsecond.

Can we check to see if the pointer does refer to an initialised mutex
object before calling unlock?  If so what would be the code for this?

I am going to upgrade to the 1.6.2 SVN version of chan_local.c - it's not
substantially different, so far as I can tell.  I will repost when the
error next occurs. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-02-22 10:17 kebl0155       Note Added: 0118333                          
======================================================================




More information about the asterisk-bugs mailing list