Artur Frysiak wrote:
> 
> Hello
> I have cyrus-imapd 2.0.7.
> Some time imapd eat 90% CPU time.
> I start gdb and see:
> (gdb) where
> #0  parse_cached_envelope (env=0x810f9b0 "\"Sat, 25 Nov 2000 18:26:49 +0100", 
>tokens=0xbffff2d4) at index.c:3019
> #1  0x805c191 in index_msgdata_load (msgno_list=0x810d7a8, n=145, 
>sortcrit=0x810d5d0) at index.c:2970
> #2  0x80589b6 in index_sort (mailbox=0x80fa8e0, sortcrit=0x810d5d0, 
>searchargs=0x810d6c0, usinguid=1) at index.c:1054
> #3  0x8051df6 in cmd_sort (tag=0x810c0d8 "00000010", usinguid=1) at imapd.c:2917
> #4  0x804e3fe in cmdloop () at imapd.c:1148
> #5  0x804c647 in service_main (argc=1, argv=0xbffffd04, envp=0xbffffd0c) at 
>imapd.c:471
> #6  0x804b41e in main (argc=1, argv=0xbffffd04, envp=0xbffffd0c) at service.c:223
> (gdb) list
> 3014    {
> 3015        char *c;
> 3016        int i = 0, len, ncom;
> 3017
> 3018        c = env;
> 3019        while (*c != '\0') {
> 3020            switch (*c) {
> 3021            case ' ':                       /* end of token */
> 3022                *c = '\0';                  /* mark end of token */
> 3023                c++;
> (gdb) print *c
> $1 = 41 ')'
> (gdb) n
> 3020            switch (*c) {
> 1: *c = 41 ')'
> (gdb)
> 3019        while (*c != '\0') {
> 1: *c = 41 ')'
> (gdb)
> 3020            switch (*c) {
> 1: *c = 41 ')'
> (gdb)
> 3019        while (*c != '\0') {
> 1: *c = 41 ')'
> (gdb)
> 3020            switch (*c) {
> 1: *c = 41 ')'
> (gdb)
> 3019        while (*c != '\0') {
> 1: *c = 41 ')'
> (gdb)
> 3020            switch (*c) {
> 1: *c = 41 ')'


Hmmm...  Unless there is a flaw in my logic for parsing address lists in
the cached envelope, I think you might have a corrupt cache.  You might
want to reconstruct the mailbox in question.

That being said, I should handle unexpected input (right now, it gets
into a tight infinite loop).  Applying the following patch should fix
the problem, if reconstructing the mailbox doesn't.  Sorry for the
nconvenience.

BTW, what IMAP client was using the SORT extension (Pine, some c-client
based software)?

diff -c -r1.146 index.c
*** index.c     2000/11/19 05:23:13     1.146
--- index.c     2000/11/28 16:26:23
***************
*** 3122,3127 ****
--- 3122,3131 ----
            }
            *(c-1) = '\0';              /* end of list - trim close
paren */
            break;
+       default:
+           /* yikes! unparsed junk, just skip it */
+           c++;
+           break;
        }
      }
  }


-- 
Kenneth Murchison     Oceana Matrix Ltd.
Software Engineer     21 Princeton Place
716-662-8973 x26      Orchard Park, NY 14127
--PGP Public Key--    http://www.oceana.com/~ken/ksm.pgp

Reply via email to