[Home]

Summary:ASTERISK-03322: Two simultaneous connections to a mailbox: only one survives
Reporter:Jim Van Meggelen (jimvanm)Labels:
Date Opened:2005-01-21 05:19:20.000-0600Date Closed:2008-01-15 15:23:33.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_voicemail
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 3394.patch
( 1) app_voicemail.c_attempttofixoverwrite.txt
( 2) app_voicemail.c.rej
( 3) mydiff.txt
( 4) output_from_patch
( 5) what_STABLE_has
( 6) what_the_diff_file_reports_was_changed_in_HEAD
Description:It appears that the same INBOX/msg0000 file is created for both recordings. Only one message survives.

I have not tested this in HEAD, but I could not find any previous bugs relating to the problem.


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

 == Everyone is busy/congested at this time
   -- Executing VoiceMail("IAX2/FirstIAXy@FirstIAXy/1", "u535232") in new stack
   -- Playing 'voicemail/default/535232/unavail' (language 'en')
   -- Got SIP response 603 "Decline" back from 192.168.1.120
   -- SIP/6888-5bfc is busy
 == Everyone is busy/congested at this time
   -- Executing VoiceMail("Zap/1-1", "u535232") in new stack
   -- Playing 'voicemail/default/535232/unavail' (language 'en')
   -- Playing 'vm-intro' (language 'en')
   -- Playing 'vm-intro' (language 'en')
   -- Playing 'beep' (language 'en')
   -- Playing 'beep' (language 'en')
   -- Recording the message
   -- x=0, open writing:  /var/spool/asterisk/voicemail/default/535232/INBOX/msg0000 format: wav49, 0x8136018
   -- x=1, open writing:  /var/spool/asterisk/voicemail/default/535232/INBOX/msg0000 format: gsm, 0x812e620
   -- x=2, open writing:  /var/spool/asterisk/voicemail/default/535232/INBOX/msg0000 format: wav, 0x8139068
   -- Recording the message
   -- x=0, open writing:  /var/spool/asterisk/voicemail/default/535232/INBOX/msg0000 format: wav49, 0x812ee08
   -- x=1, open writing:  /var/spool/asterisk/voicemail/default/535232/INBOX/msg0000 format: gsm, 0x8119090
   -- x=2, open writing:  /var/spool/asterisk/voicemail/default/535232/INBOX/msg0000 format: wav, 0x8157be8
   -- User hung up
Comments:By: Jim Van Meggelen (jimvanm) 2005-01-21 05:21:29.000-0600

The following was reported on Asterisk-Users:

-----Original Message-----
From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Stojan Sljivic - Pamet
Sent: January 21, 2005 5:32 AM
To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
Subject: [Asterisk-Users] Voicemail Synchronization


Hi,

I have stress tested the Asterisk Voicemail.
We have encountered problem with simultaneous calls that are sent to the same mailbox.
It occurred that several calls were writing to the same file.

It seems that there is a synchronization issue in the Voicemail application.

Did someone else find this issue?
What would be the solution/workaround for it?

Regards,
Stojan Sljivic

By: Jim Van Meggelen (jimvanm) 2005-01-21 05:36:37.000-0600

This is my first bug submission, and I'm kinda wondering if the severity should have been flagged as major. I based my decision on the following criteria:
# MAJOR: A bug which completely prevents Asterisk from operating in a method that it normally is expected to operate -- and particularly if it cannot be reasonably worked around -- is MAJOR. Significant protocol violations that are not simply policy decisions are MAJOR.
# MINOR: A bug which is an irritation -- but clearly is still a bug and not just wanting to see something behave differently are MINOR bugs.

This problem could be causing all kinds of people to be losing messages and not know about it (especially on a busy system), so under the aforementioned criteria I'm pretty sure believe it qualifies as major.

By: mochouinard (mochouinard) 2005-01-21 07:27:07.000-0600

It shouldnt considered Major, allthrought I think it a major issue.  Loosing voicemail could be VERY critical for some people, other just don't check their voicemail.
We need to do a global locking before assigning a message number, and even, if posible, make vm use unique filename for everyfile, and have a small parsing function that load information from all the .txt file, into a struct, so we can sort these struct, but could be alittle heavy when you have 200 msg in a folder.  Or use the date/time on the file itself to do the sorting.

By: mochouinard (mochouinard) 2005-01-21 08:00:23.000-0600

I've just code it, not actually tryed it, but it might fix your problem.  Maybe not.

By: Jim Van Meggelen (jimvanm) 2005-01-21 16:43:13.000-0600

Tried applying the patch but got errors. I don't have much experience with this so forgive me if I've done something wrong.

By: mochouinard (mochouinard) 2005-01-21 17:05:38.000-0600

My patch is for CVS HEAD... I don't use stable ..  you could port the changes easily, check at the patch, I just add LOCK at statigic location.

By: Mark Spencer (markster) 2005-01-21 17:52:39.000-0600

It should only be necesary to lock on a per-context/mailbox basis.

By: mochouinard (mochouinard) 2005-01-21 17:54:52.000-0600

You are right, I wasn't wakeup yet when I made this patch hehe. I'll see how I can do it that way.

By: Jim Van Meggelen (jimvanm) 2005-01-22 09:32:51.000-0600

I have uploaded two files. A block of code was changed between STABLE and HEAD, which is a brick wall for me due to my inexperience with coding in C.

Perhaps what I will do is grab a copy of HEAD, and test with that. Later it can be decided whether it this patch should be added to STABLE 1.0.5 or STABLE 1.2.0 (which, rumour has it, is targeted for late Feb/early March?)

By: Mark Spencer (markster) 2005-01-22 12:16:02.000-0600

I'm working on a more proper fix for this.

By: Mark Spencer (markster) 2005-01-23 03:02:43.000-0600

Fixed in CVS head, but this is a pretty intrusive fix.  Not sure what russell will want to do in stable.

By: Russell Bryant (russell) 2005-01-23 13:16:13.000-0600

If someone wants to port the fix, then I wouldn't be opposed to put it in.  It is just very unlikely that I'll be able to ...

By: Russell Bryant (russell) 2005-01-24 01:39:17.000-0600

Robert Jackson has provided a patch for 1.0, however it needs some testing before it can go in

By: Russell Bryant (russell) 2005-01-27 18:04:22.000-0600

Reminder sent to JimVanM

have you tested this patch on stable?

Please send me an email or add a bugnote to let me know.

By: Russell Bryant (russell) 2005-01-29 00:53:30.000-0600

This should be fixed in stable now.  Jim and Robert have both reported to me that they have tried this patch for 1.0 with success

Thanks Robert!

By: Digium Subversion (svnbot) 2008-01-15 15:23:02.000-0600

Repository: asterisk
Revision: 4881

U   trunk/app.c
U   trunk/apps/app_meetme.c
U   trunk/apps/app_voicemail.c
U   trunk/include/asterisk/app.h

------------------------------------------------------------------------
r4881 | markster | 2008-01-15 15:23:01 -0600 (Tue, 15 Jan 2008) | 2 lines

Make sure two voicemails can't take the same message space (bug ASTERISK-3322)

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

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

By: Digium Subversion (svnbot) 2008-01-15 15:23:33.000-0600

Repository: asterisk
Revision: 4914

U   branches/v1-0/app.c
U   branches/v1-0/apps/app_voicemail.c
U   branches/v1-0/include/asterisk/app.h

------------------------------------------------------------------------
r4914 | russell | 2008-01-15 15:23:32 -0600 (Tue, 15 Jan 2008) | 2 lines

fix simultaneous voicemail messages -- Thanks Robert! (bug ASTERISK-3322)

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

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