[Home]

Summary:ASTERISK-01255: app_voicemail fails to release channel if mailapp hangs
Reporter:twisted (twisted)Labels:
Date Opened:2004-03-20 22:38:56.000-0600Date Closed:2008-01-15 14:48:18.000-0600
Priority:BlockerRegression?No
Status:Closed/CompleteComponents:Applications/app_voicemail
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:in app_voicemail.c, line 814, pclose(p) fails if external mail program hangs, causing app_voicemail to hold the channel attached to it, regardless of actual state, blocking that channel from future use until a restart.   It is not an application problem, it is sendmail, but app_voicemail.so should be graceful when handling this, perhaps destroy the channel BEFORE attempting to send email notification.

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

Pertanant Info from gdb (mostly):
Thread 19 (Thread 147474 (LWP 8715)):
#0  0x420ae169 in wait4 () from /lib/i686/libc.so.6
#1  0x4212a2d0 in __DTOR_END__ () from /lib/i686/libc.so.6
#2  0x4206439a in _IO_proc_close@@GLIBC_2.1 () from /lib/i686/libc.so.6
#3  0x4206c713 in _IO_new_file_close_it () from /lib/i686/libc.so.6
#4  0x42062588 in fclose@@GLIBC_2.1 () from /lib/i686/libc.so.6
ASTERISK-1  0x42069e1f in pclose@@GLIBC_2.1 () from /lib/i686/libc.so.6
ASTERISK-2  0x41f98c9c in sendmail (srcemail=0x41f9e560 "asterisk", vmu=0x471f6edc,
   msgnum=4, mailbox=0x471f720c "1003",
   callerid=0x81632d0 "\"Josh Roberson <(615) 533-4094>\"",
   attach=0x471f745c "/var/spool/asterisk/voicemail/default/1003/INBOX/msg0004", format=0x41f9d128 "WAV", duration=3, attach_user_voicemail=0)
   at app_voicemail.c:814
ASTERISK-3  0x41f9414d in leave_voicemail (chan=0x41f9c3a0,
   ext=0xfffffe00 <Address 0xfffffe00 out of bounds>, silent=0, busy=0,
   unavail=1) at app_voicemail.c:1512

At this point, sendmail is hung, and will not recognize the EOF marker placed by app_voicemail.  
Comments:By: Mark Spencer (markster) 2004-03-21 02:55:41.000-0600

Can't destroy it before sending the e-mail.  We could put the data in a temporary file, then spawn sendmail from the temp file in the background.

By: Mark Spencer (markster) 2004-03-21 03:06:37.000-0600

Okay I did the temporary file thing.  It's totally untested, but in CVS (hey, it's almost 2 a.m. and i'm tired and cranky).  Let me know if that did it.

By: twisted (twisted) 2004-03-21 05:01:21.000-0600

That does fix the channel being destroyed problem, however it spawns a new issue if sendmail is hanging - it will not allow asterisk to be restarted, or if killed, and sendmail is still hung, it will not restart or even start normally for that matter until the sendmail process is destroyed.  

The asterisk process is destroyed fine during 'restart now' and 'stop now' commands, however when attempting to restart, it mentions there is an existing asterisk.ctl file in /var/run that does not exist, and 'asterisk -r' will attempt to execute and attach to a pid that is non-existant.  The existance of the astmail-* file in /tmp has no result - it gets deleted when * is able to start back up after sendmail spawn has been killed.

By: twisted (twisted) 2004-03-21 05:37:01.000-0600

I attempted to start asterisk after stop now and attempted to get another trace, however, I was not able to get any kind of trace, since * is not able to start itself.  I made sure there were no ctl or pid files related to * in /var/run, but was still not able to get gdb to allow me to go in and see where the problem now lies.  I will be back around 5:30-6pm today, 3/21.  I will be happy to help more at that time.

By: Mark Spencer (markster) 2004-03-21 13:31:37.000-0600

Okay, I've created an ast_safe_system() which should resolve this.  Can you try it and see if this fixes it fo real?

By: twisted (twisted) 2004-03-21 19:57:45.000-0600

Nice can of raid you got there. :)   Now works as expected.  This issue has been resolved to the best of my testing ability.

By: Brian West (bkw918) 2004-03-21 20:23:19.000-0600

twisted said you fixed this... :)

By: Digium Subversion (svnbot) 2008-01-15 14:48:18.000-0600

Repository: asterisk
Revision: 2511

U   trunk/apps/app_voicemail.c

------------------------------------------------------------------------
r2511 | markster | 2008-01-15 14:48:17 -0600 (Tue, 15 Jan 2008) | 2 lines

Create temporary file and then sendmail it, then delete it, to avoid a hanging mailcmd from hanging asterisk (bug ASTERISK-1255)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=2511