Hello,

A setup of Asterisk 12 with IMAP-uw 2007e works ok with the default value
of "maxmsg=100" on voicemail.conf

However, if I increase that value to a higher limit (maxmsg=400, for
example), Asterisk crashes when reaching a voicemail count of about 250 to
280 messages.  I have reproduced this issue with different asterisk
versions, see the full Asterisk backtrace and developer comments on
https://issues.asterisk.org/jira/browse/ASTERISK-23759
I saw a similar problem on this email thread:
https://mailman13.u.washington.edu/mailman/htdig/imap-uw/2007-October/001707.html

Looks like the issue is on the double call to mail_open, but the Asterisk
developers say the first calling of mail_open gives back an invalid handle
to a MAILSTREAM. Maybe this is due to the number of messages beign too
large?   So far on all the tests the crash happens when the mailbox has
more than ~250 messages.


The fuction where mail_open is called twice is the following:

########
static int init_mailstream(struct vm_state *vms, int box)
{
        MAILSTREAM *stream = NIL;
        long debug;
        char tmp[256];

        if (!vms) {
                ast_log(LOG_ERROR, "vm_state is NULL!\n");
                return -1;
        }
        ast_debug(3, "vm_state user is:%s\n", vms->imapuser);
        if (vms->mailstream == NIL || !vms->mailstream) {
                ast_debug(1, "mailstream not set.\n");
        } else {
                stream = vms->mailstream;
        }
        /* debug = T;  user wants protocol telemetry? */
        debug = NIL;  /* NO protocol telemetry? */

        if (delimiter == '\0') {                /* did not probe the server
yet */
                char *cp;
#ifdef USE_SYSTEM_IMAP
#include <imap/linkage.c>
#elif defined(USE_SYSTEM_CCLIENT)
#include <c-client/linkage.c>
#else
#include "linkage.c"
#endif
                /* Connect to INBOX first to get folders delimiter */
                imap_mailbox_name(tmp, sizeof(tmp), vms, 0, 1);
                ast_mutex_lock(&vms->lock);
                stream = mail_open (stream, tmp, debug ? OP_DEBUG : NIL);
                ast_mutex_unlock(&vms->lock);
                if (stream == NIL) {
                        ast_log(LOG_ERROR, "Can't connect to imap server
%s\n", tmp);
                        return -1;
                }
                get_mailbox_delimiter(vms, stream);
                /* update delimiter in imapfolder */
                for (cp = vms->imapfolder; *cp; cp++)
                        if (*cp == '/')
                                *cp = delimiter;
        }
        /* Now connect to the target folder */
        imap_mailbox_name(tmp, sizeof(tmp), vms, box, 1);
        ast_debug(3, "Before mail_open, server: %s, box:%d\n", tmp, box);
        ast_mutex_lock(&vms->lock);
        vms->mailstream = mail_open (stream, tmp, debug ? OP_DEBUG : NIL);
        ast_mutex_unlock(&vms->lock);
        if (vms->mailstream == NIL) {
                return -1;
        } else {
                return 0;
        }
}
######################

Any help would be appreciated,

Thank you and best regards,

Alejandro
_______________________________________________
Imap-uw mailing list
Imap-uw@u.washington.edu
http://mailman13.u.washington.edu/mailman/listinfo/imap-uw

Reply via email to