[asterisk-bugs] [Asterisk 0016271]: [patch] message limit (maxmsg) can be exceeded in 1.6.x creating orphan voicemail

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Jan 15 13:30:04 CST 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=16271 
====================================================================== 
Reported By:                sohosys
Assigned To:                tilghman
====================================================================== 
Project:                    Asterisk
Issue ID:                   16271
Category:                   Applications/app_voicemail
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     ready for testing
Target Version:             1.6.0.22
Asterisk Version:           SVN 
JIRA:                       SWP-432 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-11-18 08:27 CST
Last Modified:              2010-01-15 13:30 CST
====================================================================== 
Summary:                    [patch] message limit (maxmsg) can be exceeded in
1.6.x creating orphan voicemail
Description: 
If two are more users are in the process of leaving a voicemail message,
and the count of messages in the mailbox was maxmsg-1 when they started
leaving the message, the application will record all new messages.

Messages will be numbered in the order they were completed, and all
messages over the limit will be inaccessible to the end user. We have
tested up to 5 callers in voicemail resulting in maxmsg+4 messages and 4
inaccessible messages. I assume there is no limit based on the code.

We run some high volume asterisk servers where this has become common. In
the 1.6 series the message is not reported and not accessible by the end
user, although the caller that left the last messages(s) had no indication
of the full mailbox.

I guess this could be classified as minor or major depending on the
content of the messages in the black hole and the job title of the mailbox
owner.

In the 1.2.x series a crash is the result when the end user tries to
access the last messages in the mailbox, and we fixed that by simply adding
10 to our desired maxmsg count in voicemail.conf and changing the code to
test for msgcount <= maxmsg - 10 before accepting a new message, but the
1.6 code is more complex, and our 1.2 solution is too primitive for a
current version, although transparently buffering the variables might be a
good simple solution.
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0015117 crash in voicemail when more than maxms...
====================================================================== 

---------------------------------------------------------------------- 
 (0116740) jsutton (reporter) - 2010-01-15 13:30
 https://issues.asterisk.org/view.php?id=16271#c116740 
---------------------------------------------------------------------- 
I am working on this issue with sohosys. The original patch failed to apply
to 1.6.0.13, 1.6.0.20 the output from the patch command is provided below.

Failed 1.6.0.20
patching file apps/app_voicemail.c
Hunk https://issues.asterisk.org/view.php?id=1 FAILED at 102.
Hunk https://issues.asterisk.org/view.php?id=2 succeeded at 438 with fuzz 2
(offset 29 lines).
Hunk https://issues.asterisk.org/view.php?id=3 FAILED at 3891.
Hunk https://issues.asterisk.org/view.php?id=4 FAILED at 4282.
Hunk https://issues.asterisk.org/view.php?id=5 FAILED at 4292.
Hunk https://issues.asterisk.org/view.php?id=6 succeeded at 4646 with fuzz 1
(offset 356 lines).
Hunk https://issues.asterisk.org/view.php?id=7 FAILED at 4695.
Hunk https://issues.asterisk.org/view.php?id=8 FAILED at 4704.
Hunk https://issues.asterisk.org/view.php?id=9 succeeded at 4415 with fuzz 2
(offset 42 lines).
Hunk https://issues.asterisk.org/view.php?id=10 succeeded at 4777 (offset 371
lines).
Hunk https://issues.asterisk.org/view.php?id=11 FAILED at 4810.
Hunk https://issues.asterisk.org/view.php?id=12 FAILED at 7932.
Hunk https://issues.asterisk.org/view.php?id=13 FAILED at 9340.
Hunk https://issues.asterisk.org/view.php?id=14 FAILED at 9365.
10 out of 14 hunks FAILED -- saving rejects to file
apps/app_voicemail.c.rej

Failed 1.6.0.13
patching file apps/app_voicemail.c
Hunk https://issues.asterisk.org/view.php?id=1 FAILED at 102.
Hunk https://issues.asterisk.org/view.php?id=2 succeeded at 433 with fuzz 2
(offset 24 lines).
Hunk https://issues.asterisk.org/view.php?id=3 FAILED at 3886.
Hunk https://issues.asterisk.org/view.php?id=4 FAILED at 4277.
Hunk https://issues.asterisk.org/view.php?id=5 FAILED at 4287.
Hunk https://issues.asterisk.org/view.php?id=6 FAILED at 4314.
Hunk https://issues.asterisk.org/view.php?id=7 FAILED at 4363.
Hunk https://issues.asterisk.org/view.php?id=8 FAILED at 4372.
Hunk https://issues.asterisk.org/view.php?id=9 FAILED at 4397.
Hunk https://issues.asterisk.org/view.php?id=10 succeeded at 4369 with fuzz 2
(offset -37 lines).
Hunk https://issues.asterisk.org/view.php?id=11 FAILED at 4402.
Hunk https://issues.asterisk.org/view.php?id=12 FAILED at 7524.
Hunk https://issues.asterisk.org/view.php?id=13 FAILED at 8932.
Hunk https://issues.asterisk.org/view.php?id=14 FAILED at 8957.
12 out of 14 hunks FAILED -- saving rejects to file
apps/app_voicemail.c.rej

I decided to try the patch against 1.6.2 after determining that the issue
is still present. note: the crash issue is present in 1.2.x and 1.6.2.x,
but 1.6.0 seems to handle the bug more gracefully. I was able to adapt most
of the patch to 1.6.2, with the following exceptions listed below. After
testing the modified patch on 1.6.2 we were able to determine that the
issue no longer exists. The patch did however induce a secondary issue in
which the max messages is effectively maxmsg-1. This may be due to our
adaptation of the patch to the 1.6.2 code.

Not compatible
@@ -4202,7 +4253,7 @@
 		}
 		if (option_debug > 2)
 			ast_log(LOG_DEBUG, "Checking message number quota - mailbox has %d
messages, maximum is set to %d\n",msgnum,vmu->maxmsg);
-		if (msgnum >= vmu->maxmsg) {
+		if (msgnum >= vmu->maxmsg - inprocess_count(vmu->mailbox, vmu->context,
0)) {
 			res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
 			if (!res)
 				res = ast_waitstream(chan, "");


@@ -7501,9 +7561,11 @@
 #endif
 	if (!(vms.deleted = ast_calloc(vmu->maxmsg, sizeof(int)))) {
 		/* TODO: Handle memory allocation failure */
+		goto out;
 	}
 	if (!(vms.heard = ast_calloc(vmu->maxmsg, sizeof(int)))) {
 		/* TODO: Handle memory allocation failure */
+		goto out;
 	}
 	
 	/* Set language from config to override channel language */

Not sure about

@@ -8931,6 +8994,10 @@
 		return AST_MODULE_LOAD_DECLINE;
 	}
 
+	if (!(inprocess_container = ao2_container_alloc(573, inprocess_hash_fn,
inprocess_cmp_fn))) {
+		return AST_MODULE_LOAD_DECLINE;
+	}
+
 	my_umask = umask(0);
 	umask(my_umask);
 	res = ast_register_application(app, vm_exec, synopsis_vm, descrip_vm);

I have provided the adapted patch for 1.6.2.x in case anyone finds it
useful. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-01-15 13:30 jsutton        Note Added: 0116740                          
======================================================================




More information about the asterisk-bugs mailing list