[Home]

Summary:ASTERISK-09369: Asterisk random segfault
Reporter:Andrey Solovyev (corruptor)Labels:
Date Opened:2007-05-02 08:47:54Date Closed:2007-07-11 19:59:16
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) core.21342.bt
( 1) core.21342.full
( 2) core.2151.bt
( 3) core.2151.full
( 4) core.25622.bt
( 5) core.25622.full
Description:Asterisk 1.4.4. crashes randomly with my dialplan. It has crashed 4 times for the last 4 hours.  
Appearently there are different reasons for the crashes.
For example I find this messages in log file:
[02 09:51:46] ERROR[2226] /usr/src/asterisk-1.4.4-debug/include/asterisk/lock.h: chan_sip.c line 14931 (sipsock_read): mutex '&p->owner->lock' freed more times than we've locked!
Crash happens sometimes after this message.
Maybe the problem is with my Dial command with M option. It executes macro baginagentcall which contains MixMonitor application. I will try to remove M option and see if this stops crashes.
I attach several bts with full logs.

****** ADDITIONAL INFORMATION ******

Server is not heavily loaded - only about 7-10 concurrent calls.
I use FC6.

There many messages in log files:
[02 09:51:46] ERROR[2226] /usr/src/asterisk-1.4.4-debug/include/asterisk/lock.h: chan_sip.c line 14931 (sipsock_read): mutex '&p->owner->lock' freed more times than we've locked!
[02 09:51:46] ERROR[2226] /usr/src/asterisk-1.4.4-debug/include/asterisk/lock.h: chan_sip.c line 14931 (sipsock_read): Error releasing mutex: Operation not permitted

I use several queues with Local channels. In order to record calls I use M option of the dial. When agent answers the call macro beginagentcall is executed. It contains MixMonitor application wich starts recording a call. Local channels are used quite often.
All phones are SIP. Manager Originate application is also used for  our outgoing callcenter. All outgoing calls are also recorded using Mixmonitor application (in ordinary way, MixMonitor is executed before Dial).

Same dialplan leads to rare deadlocks on asterisk 1.2.18. I haven't got any problem on 1.2.13.
Comments:By: Ramon Peek-Fares (ramonpeek) 2007-05-03 08:25:11

In my production dialplan Asterisk also crashes, but ONLY when I use the Group function in combination with Local channels.
When I revert to 1.4.3, there is no problem.
I have not been able to reproduce this with a simple dialplan, however I did notice that the Group function is currently broken.
I listed it under bugreport: http://bugs.digium.com/view.php?id=9657

It might be these two are related??
Perhaps usefull to know...

By: Andrey Solovyev (corruptor) 2007-05-03 11:40:06

Ok. I've found out that this is pickup (res_features) problem. I'm able to reproduce this message in test environment:
[May  3 20:30:45] ERROR[23060]: /usr/src/asterisk-1.4.4/include/asterisk/lock.h:336 __ast_pthread_mutex_unlock: chan_sip.c line 14931 (sipsock_read): mutex '&p->owner->lock' freed more times than we've locked!
[May  3 20:30:45] ERROR[23060]: /usr/src/asterisk-1.4.4/include/asterisk/lock.h:349 __ast_pthread_mutex_unlock: chan_sip.c line 14931 (sipsock_read): Error releasing mutex: Operation not permitted

It's written every time I do pickup. I tried to pickup many times but asterisk crashed only once so it's random.

ramonpeek,
I use groups too but I think mine is not releated because I had crashes on earlier viersions.

By: Andrey Solovyev (corruptor) 2007-05-04 11:46:43

I've found out that this message appears when asterisk 1.4.4 is compiled with DEBUG_THREAD and DONT_OPTIMIZE when we pickup call using *8 (defined in features.conf) during from call from one SIP phone to another SIP phone.
We have 3 SIP friends defined in sip.conf - 100, 101, 102.
extension.conf is simple:
[default]
exten => 100,1,Dial(SIP/100)
exten => 101,1,Dial(SIP/101)
exten => 102,1,Dial(SIP/102)

100 calls 101 and 102 dials *8 and does call pickup successfully but these messages appear:
[May 3 20:30:45] ERROR[23060]: /usr/src/asterisk-1.4.4/include/asterisk/lock.h:336 __ast_pthread_mutex_unlock: chan_sip.c line 14931 (sipsock_read): mutex '&p->owner->lock' freed more times than we've locked!
[May 3 20:30:45] ERROR[23060]: /usr/src/asterisk-1.4.4/include/asterisk/lock.h:349 __ast_pthread_mutex_unlock: chan_sip.c line 14931 (sipsock_read): Error releasing mutex: Operation not permitted
Sometimes asterisk crashes.

I guess that if * tries to unlock channel it should be locked. As I understand it's not good that channel has already been unlocked.

By: Russell Bryant (russell) 2007-06-06 16:16:14

This issue has been resolved in 1.4 and trunk in revisions 67862 and 67863.  Thanks!