[Home]

Summary:ASTERISK-17130: [patch] [regression] Resequencing of mailbox not working as expected.
Reporter:Joe Cracchiolo (jjcinaz)Labels:
Date Opened:2010-12-18 11:32:57.000-0600Date Closed:2011-01-25 11:05:59.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_voicemail
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) bug18498.patch
( 1) bug18498v2.patch
Description:Changes made on 2010-10-26 by jpeeler [2010-10-26 18:33 +0000 [r293118]  Jeff Peeler <jpeeler@digium.com>] to resequence_mailbox() cause the whole routine to not be effective.  

The function was changed to go up to the actual number of messages found in the directory (count_msg parameter) instead of the old limit of max_msgs+10.  The problem introduced is one where count_msg is 0 because the msg0000.<fmt> file is not there, yet msg0001.<fmt> does exist.  This will cause the following errors now in the log:

Dec 17 12:44:10] NOTICE[3723] app_voicemail.c: Resequencing Mailbox: /var/spool/asterisk/voicemail/xx/7104/INBOX, expected 0 but found 1 message(s) in box with max threshold of 100.
[Dec 17 12:44:17] WARNING[3723] app_voicemail.c: No message attribute file?!! (/var/spool/asterisk/voicemail/xx/7104/INBOX/msg0000.txt)

Comments:By: Joe Cracchiolo (jjcinaz) 2010-12-18 12:01:43.000-0600

I believe the proper fix is to test up to the count_msg+1 (not one less than) and increment the count_msg variable if we just detected an out of sequence file.  This has the effect of keeping the resequence going until we exhaust the out of sequence files even if the max_msgs has changed in the meantime.  I additionally added a top end limit so we don't go nuts with files:

for (x = 0, dest = 0; x <= count_msg + 1 && x < 9999; x++) {
make_file(sfn, sizeof(sfn), dir, x);
if (EXISTS(dir, x, sfn, NULL)) {
if (x != dest) {
make_file(dfn, sizeof(dfn), dir, dest);
RENAME(dir, x, vmu->mailbox, vmu->context, dir, dest, sfn, dfn);
count_msg++;  /* we have to keep going because we found one off the end and out of sequence */
}
dest++;
}
}

We're testing this internally and will update but another set of eyes would be good.

By: Tilghman Lesher (tilghman) 2010-12-18 12:51:06.000-0600

That's also not quite right, because if two messages are deleted in sequence, then your routine will not find messages beyond that limit, until another message "bridges" the gap.

By: Michael Gaudette (bluefox) 2010-12-23 08:31:18.000-0600

You can link this with 0018486.

Any quick patch will be appreciated and tested by myself.

By: Jeff Peeler (jpeeler) 2011-01-03 14:44:14.000-0600

I was not able to reproduce the problem simply by removing the msg0000* files, however I did fix some related issues that may solve the problem.

By: Michael Gaudette (bluefox) 2011-01-05 09:51:25.000-0600

How ridiculous would be just updating my app_voicemail.c to the latest SVN file to test whether this is fixed or not, without changing the rest of the application? (Im on 1.6.16rc1)

By: David Brillert (aragon) 2011-01-06 12:08:17.000-0600

I'm seeing this exact issue in 1.4 SVN
User reports not being able to play back the last message if more than one message exists in INBOX.

[2011-01-06 12:53:48] NOTICE[26643] app_voicemail.c: Resequencing Mailbox: /var/spool/asterisk/voicemail/default/750/INBOX, expected 0 but found 1 message(s) in box with max threshold of 100.
[2011-01-06 12:53:57] WARNING[26643] app_voicemail.c: No message attribute file?!! (/var/spool/asterisk/voicemail/default/750/INBOX/msg0000.txt)
[2011-01-06 12:55:48] NOTICE[28695] app_voicemail.c: Resequencing Mailbox: /var/spool/asterisk/voicemail/default/750/INBOX, expected 0 but found 1 message(s) in box with max threshold of 100.

/var/spool/asterisk/voicemail/default/750/INBOX only includes msg0004.txt and msg0004.WAV

By: Jeff Peeler (jpeeler) 2011-01-06 17:45:58.000-0600

Aragon, there's a patch there to test if you can.

By: David Brillert (aragon) 2011-01-07 08:06:29.000-0600

jpeeler: I can't apply the patch to my customer's effected production system however I do have a lab where I can test the patch.  But I cannot reproduce the problem in my lab...
If anyone can tell me how to easily reproduce this problem I will test the patch in my lab ASAP.

By: Jeff Peeler (jpeeler) 2011-01-07 14:05:15.000-0600

I had been manually deleting files in the spool folder to create gaps. I was hoping to have a real world test though since I can easily do that myself.

By: Jeff Peeler (jpeeler) 2011-01-07 14:06:25.000-0600

Bluefox, did you notice the 1.6 patch on ASTERISK-17118?



By: Jeff Peeler (jpeeler) 2011-01-14 14:29:46.000-0600

New patch, I'll probably just merge it if nobody says anything.

By: Nathan Jett (njett) 2011-01-19 15:56:18.000-0600

I'm experiencing these symptoms on a new install of Asterisk 1.8.1.1.  In the asterisk log I see:

[Jan 19 13:28:12] WARNING[5166] app_voicemail.c: No message attribute file?!! (/var/spool/asterisk/voicemail/default/243/INBOX/msg0000.txt)

and looking in the /var/spool/asterisk/voicemail/default/243/INBOX/ directory there is no msg0000.txt but there is an msg0001.txt and .wav file.

I tried to apply the patch here but I get the following:

pbx:/usr/src/asterisk-1.8.1.1# wget 'https://issues.asterisk.org/file_download.php?file_id=28223&type=bug' -O - | patch -p0
--2011-01-19 15:55:16--  https://issues.asterisk.org/file_download.php?file_id=28223&type=bug
Resolving issues.asterisk.org... 76.164.171.231, 2001:470:e0d4::e7
Connecting to issues.asterisk.org|76.164.171.231|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3402 (3.3K) [text/plain]
Saving to: `STDOUT'

100%[==============================================================================================================>] 3,402       --.-K/s   in 0.04s

2011-01-19 15:55:16 (90.6 KB/s) - `-' saved [3402/3402]

patching file apps/app_voicemail.c
Hunk #1 FAILED at 2906.
Hunk #2 FAILED at 4557.
Hunk #3 FAILED at 4568.
Hunk #4 FAILED at 6027.
4 out of 4 hunks FAILED -- saving rejects to file apps/app_voicemail.c.rej

By: Jeff Peeler (jpeeler) 2011-01-19 16:39:53.000-0600

Well 1.8.1 is kind of old, so I'm not too surprised it didn't apply. Since it's a new install why don't you try and install 1.8.2 at least (or really 1.8.2.1 as of now).

By: Ronald Chan (loloski) 2011-01-20 10:05:45.000-0600

root@stealth:/usr/src/asterisk# patch -p0 < ../simmer/mailbox.diff --dry-run
patching file apps/app_voicemail.c
Hunk #1 FAILED at 2906.
Hunk #2 FAILED at 4527.
Hunk #3 FAILED at 4538.
Hunk #4 FAILED at 5997.
4 out of 4 hunks FAILED -- saving rejects to file apps/app_voicemail.c.rej

path: .
URL: http://svn.digium.com/svn/asterisk/branches/1.8
Repository Root: http://svn.digium.com/svn/asterisk
Repository UUID: f38db490-d61c-443f-a65b-d21fe96a405b
Revision: 302919
Node Kind: directory
Schedule: normal
Last Changed Author: lmadsen
Last Changed Rev: 302918
Last Changed Date: 2011-01-20 23:45:39 +0800 (Thu, 20 Jan 2011)

(END)

does the patch bug18498v2.patch applicable for 1.8 release branch?

By: Nathan Jett (njett) 2011-01-20 10:22:31.000-0600

Well I guess when I said it was a new install I meant it was a relatively new install from 12-15-2010 back when 1.8.1.1 was the newest release out.  But to test I downloaded the 1.8.2.1 release.  From what I can see in the release notes and the source file your patch is not already included in this release.  When I attempted to apply the patch I get the following:

pbx:/usr/src/asterisk-1.8.2.1# wget 'https://issues.asterisk.org/file_download.php?file_id=28223&type=bug' -O - | patch -p0
--2011-01-20 10:19:58--  https://issues.asterisk.org/file_download.php?file_id=28223&type=bug
Resolving issues.asterisk.org... 76.164.171.231, 2001:470:e0d4::e7
Connecting to issues.asterisk.org|76.164.171.231|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3402 (3.3K) [text/plain]
Saving to: `STDOUT'

100%[========================================================================================================>] 3,402       --.-K/s   in 0.04s

2011-01-20 10:19:59 (91.0 KB/s) - `-' saved [3402/3402]

patching file apps/app_voicemail.c
Hunk #1 FAILED at 2906.
Hunk #2 FAILED at 4557.
Hunk #3 FAILED at 4568.
Hunk #4 FAILED at 6027.
4 out of 4 hunks FAILED -- saving rejects to file apps/app_voicemail.c.rej


Any other ideas?

By: Jeff Peeler (jpeeler) 2011-01-20 13:09:01.000-0600

Oops, I confused which bug this was. Issue ASTERISK-17118 has a 1.6 version based patch that applies cleanly to 1.8. Sorry about that! Please let me know how it goes.

By: Nathan Jett (njett) 2011-01-20 13:20:42.000-0600

That bug seems to look pretty similar to what I'm experiencing and the patch looks like it applied successfully.  I'll recompile and install after hours tonight to see if it fixes the prob.

By: Digium Subversion (svnbot) 2011-01-25 10:58:31.000-0600

Repository: asterisk
Revision: 303676

U   branches/1.4/apps/app_voicemail.c

------------------------------------------------------------------------
r303676 | jpeeler | 2011-01-25 10:58:30 -0600 (Tue, 25 Jan 2011) | 20 lines

Fix voicemail sequencing for file based storage.

A previous change was made to account for when the number of voicemail messages
exceeds the max limit to be handled properly, but it caused gaps in the messages
to not be properly handled. This has now been resolved.

In later non 1.4 branches, it appears that resequencing wasn't even occurring
due from what appears and accidental code removal.

(closes issue ASTERISK-17130)
Reported by: JJCinAZ
Patches:
     bug18498v2.patch uploaded by jpeeler (license 325)

(closes issue ASTERISK-17118)
Reported by: bluefox
Patches:
     bug18486.patch uploaded by jpeeler (license 325)


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

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

By: Digium Subversion (svnbot) 2011-01-25 10:59:29.000-0600

Repository: asterisk
Revision: 303677

_U  branches/1.6.2/
U   branches/1.6.2/apps/app_voicemail.c

------------------------------------------------------------------------
r303677 | jpeeler | 2011-01-25 10:59:28 -0600 (Tue, 25 Jan 2011) | 26 lines

Merged revisions 303676 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r303676 | jpeeler | 2011-01-25 10:58:29 -0600 (Tue, 25 Jan 2011) | 20 lines
 
 Fix voicemail sequencing for file based storage.
 
 A previous change was made to account for when the number of voicemail messages
 exceeds the max limit to be handled properly, but it caused gaps in the messages
 to not be properly handled. This has now been resolved.
 
 In later non 1.4 branches, it appears that resequencing wasn't even occurring
 due from what appears and accidental code removal.
 
 (closes issue ASTERISK-17130)
 Reported by: JJCinAZ
 Patches:
       bug18498v2.patch uploaded by jpeeler (license 325)
 
 (closes issue ASTERISK-17118)
 Reported by: bluefox
 Patches:
       bug18486.patch uploaded by jpeeler (license 325)
........

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

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

By: Digium Subversion (svnbot) 2011-01-25 11:02:39.000-0600

Repository: asterisk
Revision: 303678

_U  branches/1.8/
U   branches/1.8/apps/app_voicemail.c

------------------------------------------------------------------------
r303678 | jpeeler | 2011-01-25 11:02:39 -0600 (Tue, 25 Jan 2011) | 33 lines

Merged revisions 303677 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

................
 r303677 | jpeeler | 2011-01-25 10:59:28 -0600 (Tue, 25 Jan 2011) | 26 lines
 
 Merged revisions 303676 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r303676 | jpeeler | 2011-01-25 10:58:29 -0600 (Tue, 25 Jan 2011) | 20 lines
   
   Fix voicemail sequencing for file based storage.
   
   A previous change was made to account for when the number of voicemail messages
   exceeds the max limit to be handled properly, but it caused gaps in the messages
   to not be properly handled. This has now been resolved.
   
   In later non 1.4 branches, it appears that resequencing wasn't even occurring
   due from what appears and accidental code removal.
   
   (closes issue ASTERISK-17130)
   Reported by: JJCinAZ
   Patches:
         bug18498v2.patch uploaded by jpeeler (license 325)
   
   (closes issue ASTERISK-17118)
   Reported by: bluefox
   Patches:
         bug18486.patch uploaded by jpeeler (license 325)
 ........
................

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

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

By: Digium Subversion (svnbot) 2011-01-25 11:05:57.000-0600

Repository: asterisk
Revision: 303679

_U  trunk/
U   trunk/apps/app_voicemail.c

------------------------------------------------------------------------
r303679 | jpeeler | 2011-01-25 11:05:57 -0600 (Tue, 25 Jan 2011) | 40 lines

Merged revisions 303678 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r303678 | jpeeler | 2011-01-25 11:02:38 -0600 (Tue, 25 Jan 2011) | 33 lines
 
 Merged revisions 303677 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ................
   r303677 | jpeeler | 2011-01-25 10:59:28 -0600 (Tue, 25 Jan 2011) | 26 lines
   
   Merged revisions 303676 via svnmerge from
   https://origsvn.digium.com/svn/asterisk/branches/1.4
   
   ........
     r303676 | jpeeler | 2011-01-25 10:58:29 -0600 (Tue, 25 Jan 2011) | 20 lines
     
     Fix voicemail sequencing for file based storage.
     
     A previous change was made to account for when the number of voicemail messages
     exceeds the max limit to be handled properly, but it caused gaps in the messages
     to not be properly handled. This has now been resolved.
     
     In later non 1.4 branches, it appears that resequencing wasn't even occurring
     due from what appears and accidental code removal.
     
     (closes issue ASTERISK-17130)
     Reported by: JJCinAZ
     Patches:
           bug18498v2.patch uploaded by jpeeler (license 325)
     
     (closes issue ASTERISK-17118)
     Reported by: bluefox
     Patches:
           bug18486.patch uploaded by jpeeler (license 325)
   ........
 ................
................

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

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