Summary:ASTERISK-12156: Deadlock in cahn_sip when using IMAP voicemail
Reporter:Nicolas Ross (rossnick)Labels:
Date Opened:2008-06-06 12:27:44Date Closed:2008-07-21 09:14:58
Versions:Frequency of
Environment:Attachments:( 0) core_locks.txt
( 1) gdb_thread_20080603.txt
( 2) gdb_thread_20080605.txt
( 3) spditner-gdb_thread_2008-06-24.txt
Description:I have setup asterisk to use imap as voicemail storage. Sometimes (2 times since the last hours), chan_sip sould be in a deadlock situation requiring a restart of asterisk.

When it happens, no communication can be done in SIP, thus no phone can be reached, and no calls can be placed.

Attach a "core show locks" (core_locks.txt) from the 2 lockup this morning. Also attach is 2 "thread apply all bt" (gdb_thread_20080603.txt and gdb_thread_20080605.txt)that I catched while asterisk was running in the debuger while investigating another issue.
Comments:By: Russell Bryant (russell) 2008-06-06 16:25:49

It actually doesn't look like there is a deadlock in which the code is stuck forever.

Are you trying to store voicemail into a folder that includes a lot of email already, like a user's inbox?

By: Nicolas Ross (rossnick) 2008-06-06 19:10:06

If it's not a deadlock, it sure looks like it. Everything that is SIP stop working completly.

On the first core show locks, I just finished reading a voice mail from my phone. I store my VM in my own imap inbox, where I have something like 200 messages. I'am not sure how the second happen...

By: Tilghman Lesher (tilghman) 2008-06-19 17:22:57

Where is this IMAP server in relation to your Asterisk server?  On the same LAN?

By: Nicolas Ross (rossnick) 2008-06-19 17:42:50

On the other side of a 2xT1 agragated link (3 mbps with < 2 ms latency)

By: Simon P. Ditner (spditner) 2008-06-24 14:53:41

I'm experiencing the same behaviour with using imap-2007b.

My IMAP server is on the same machine, with only a couple of messages per mailbox.

By: Mark Michelson (mmichelson) 2008-07-21 09:14:51

The problem of select() calls in the IMAP c-client blocking forever is something that has been a problem for a while. I added the option of setting timeouts for the IMAP connections in trunk a while back, and I have now backported the changes to 1.4 as well.

If you check out a subversion revision later than 129208, then the appropriate TCP timeout options will be present. A default timeout of 60 seconds was chosen, but timeouts may be adjusted to your liking. See doc/imapstorage.txt to see what timeout options are available. The changes in question will also be available in the upcoming 1.4.22 version of Asterisk.

Once the timeout period has elapsed, the SIP thread will be unblocked and may continue processing calls. I am closing this issue since the timeouts should prevent the problem mentioned in the report.