Summary:ASTERISK-12498: Asterisk crashes or locks up when leaving imap messages
Reporter:Mike Oliveras (moliveras)Labels:
Date Opened:2008-07-31 18:12:16Date Closed:2008-12-18 16:02:52.000-0600
Versions:Frequency of
Environment:Attachments:( 0) gdb_edited.txt
( 1) gdb.txt
( 2) gdb2.txt
( 3) imap-issue.txt
Description:While leaving voicemail messages over imap, i would occasionally see cases where all asterisk would stop responding to sip signaling and a "sip show peers" shows no entries.  I am able to reproduce this problem 100% of the time by using a simulator (sipp) to send calls with media to an extension.  I am allowing 2 simultaneous calls at a time, and the message duration of the voicemail is approx 30 secs.  Using this method, the problem always occurs within the 1st minute or so.  I see errors in the asterisk console before the problem occurs.

I am using the Maildir format on my imap server, so each message is left in a separate file.  My imap server is dovecot-1.0.7-2.el5 running on rhel5.1.

My sipp options are:
sipp -sf uac_with_media_30secs.xml -s 650xxxxxxx -l 2 -m 1000

I was initially using asterisk built from a tarball.  I also tried building from an svn checkout of the 1.4 branch (SVN-branch-1.4-r134976) and saw the same problem.

Most times asterisk locks up, however in one instance asterisk seemed to crash.
I will attach the errors I saw in the asterisk console to this ticket.

I can reproduce this problem very easily, so just let me know what you need from me and I can get it to you.

Best Regards,

Mike Oliveras
Comments:By: Mike Oliveras (moliveras) 2008-07-31 18:15:59

I also noticed that sometimes if I restart my imap server when asterisk is hung, it will cause asterisk to restart.

By: Philip Rosenberg-Watt (kc0bvu) 2008-07-31 23:45:31

This may be the same issue I've noticed. Running and just started experimenting with IMAP storage. Checked out SVN-branch-1.4-r134983M but problem persists.

By: Mark Michelson (mmichelson) 2008-08-01 13:21:57

If Asterisk ever crashes, it would be helpful to see a backtrace so we can determine exactly where the crash occurred. As far as Asterisk getting hung, I see in the messages that there was a one minute period where nothing occurred and then the connection was broken. This happened due to the default timeout of 60 seconds for IMAP operations. Some of these hangs you are experiencing may be due to TCP problems occurring within the c-client.

Another possibility, though very unlikely when using IMAP, is that there could be a deadlock. When Asterisk appears hung, issue the command "core show locks" on the CLI and see what is returned. Also, when Asterisk is hung, if you can get a backtrace of all the threads during the hang, that could be helpful too.

For instructions on how to get a backtrace, see doc/backtrace.txt in the Asterisk source directory.

By: Mike Oliveras (moliveras) 2008-08-01 22:27:55

I attached the backtrace.  I tried a "show core locks" on the asterisk console when asterisk was hung and it returned nothing. Shortly after exiting the asterisk console, it crashed and produced a core file.

By: snuffy (snuffy) 2008-08-02 04:53:24

mollveras you should also attach a NON OPTIMIZED backtrace.

By: Mike Oliveras (moliveras) 2008-08-02 10:11:22

snuffy, I thought that I did include a NON OPTIMIZED TRACE.  I just did a make dist-clean to do a complete build.  The only thing I had to do was select DONT OPTIMIZE under Compiler Flags on make menuselect right?  I just uploaded gdb2.txt, which will hopefully give more information.

By: snuffy (snuffy) 2008-08-03 22:28:46

Thanks for the second backtrace. (optimised out values were in dovcot not asterisk my bad)

By: Philip Rosenberg-Watt (kc0bvu) 2008-10-10 16:50:01

I just uploaded a backtrace I did called "gdb_edited.txt" -- I really don't know what I'm doing but I hope I got it right. Whenever I compile asterisk 1.4 trunk with --with-imap=system or a client I compiled myself, I eventually get a crash. Maybe this will help to figure out what's wrong.

By: Jeff Peeler (jpeeler) 2008-12-02 17:30:23.000-0600

This is the same backtrace as the other related bugs I added. I have been able to reproduce the same crash locally and the patch from 13653 does seem to fix it.

By: Tilghman Lesher (tilghman) 2008-12-18 16:02:51.000-0600

Closing, as the related patch in ASTERISK-12855 has been committed.