Bug 438275

Summary: mutt (imap) hangs when quitting or changing folders with mutt_socket_write: ERROR: wrote 16384 of 99383 bytes
Product: [Fedora] Fedora Reporter: Chris Wright <chrisw>
Component: muttAssignee: Miroslav Lichvar <mlichvar>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: pertusus
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-04-04 12:08:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
snippet from .muttdebug0 none

Description Chris Wright 2008-03-20 01:05:03 UTC
Description of problem:

When quitting or changing imap folders mutt hangs

Version-Release number of selected component (if applicable):
mutt-1.5.17-2 (actually mutt-1.5.17-2d, recompiled locally to add --enable-debug
to configure step so that mutt -d [level] works)

How reproducible:
every time

Steps to Reproduce:
1. start mutt w/ imap connection to large folder, for me that is simply:
$ mutt -d 2
2. quit or change folders
3.
  
Actual results:

mutt hangs

Expected results:

mutt quits or changes imap folder


Additional info:

This seems to be related with folder size and imap command length.
The debug log ends like this (note I snipped short the UID STORE cmd)

IMAP queue drained
5> a0130 IDLE
5< + idling
5> DONE
a0131 UID STORE
242:243,245:248,255:256,275,.....111311:111314,111316:111320,111326:111333
+FLAGS.SILENT (Old)
mutt_socket_write: ERROR: wrote 16384 of 99383 bytes!
5< a0130 OK Idle completed.

and now mutt is hung (waiting to hear from imap server it appears):

recvfrom(5, "\317", 1, 0, NULL, NULL)   = 1
write(3, "5< a0130 OK Idle completed.\n", 28) = 28
gettimeofday({1205974328, 472287}, NULL) = 0
recvfrom(5,

Comment 1 Chris Wright 2008-03-20 01:05:03 UTC
Created attachment 298615 [details]
snippet from .muttdebug0

Comment 2 Miroslav Lichvar 2008-03-20 12:34:26 UTC
I couldn't reproduce the problem. Which IMAP server is mutt connected to?

With dovecot, I'm getting for large folders "BAD Error in IMAP command UID: Too
long argument.", but it doesn't make mutt hang. When dovecot is configured to
allow larger imap commands, it works fine even with larger commands than the one
in your debug output.

Comment 3 Chris Wright 2008-03-20 18:01:41 UTC
mutt is connecting to dovecot.  i tried increasing cmd line size, but it doesn't
help.

imap_max_line_length: 131072

any other info that would help?



Comment 4 Miroslav Lichvar 2008-04-03 16:09:00 UTC
Ok, I've managed to reproduce the problem with imaps. I was trying only imap before.

Comment 5 Miroslav Lichvar 2008-04-04 12:08:55 UTC
Should be fixed in mutt-1.5.17-4.fc9.

Comment 6 Chris Wright 2008-04-04 22:50:55 UTC
(gdb) bt
#0  0x00000037ff86c155 in __rep_get_limit () from /lib64/libdb-4.5.so
#1  0x0000000000481c7c in hcache_open_db4 (h=0x7a1270, 
    path=0x6b7680
"/home/chrisw/.mutt/cache/headers/imap:chrisw/INBOX.hcache") at
hcache.c:910
#2  0x0000000000480b46 in mutt_hcache_open (
    path=0x6b7680
"/home/chrisw/.mutt/cache/headers/imap:chrisw/INBOX.hcache", 
    folder=0x21 <Address 0x21 out of bounds>, namer=0x48baf0
<imap_hcache_namer>) at hcache.c:1005
#3  0x000000000048ba58 in imap_hcache_open (idata=<value optimized out>,
path=<value optimized out>) at util.c:101
#4  0x00000000004850d7 in imap_mboxcache_get (idata=0x762da0, mbox=0x7880d0
"INBOX", create=1) at imap.c:1600
#5  0x00000000004878f1 in imap_open_mailbox (ctx=0x75e860) at imap.c:629
#6  0x000000000043f452 in mx_open_mailbox (path=0x7fffd4457730
"imap://sous-sol.org/", flags=0, pctx=0x7a1ae0)
    at mx.c:692
#7  0x0000000000435ca7 in main (argc=1, argv=0x7fffd4457958) at main.c:1002
#8  0x000000380061e074 in __libc_start_main () from /lib64/libc.so.6
#9  0x00000000004060c9 in _start ()


Comment 7 Chris Wright 2008-04-04 23:08:08 UTC
I built on a box with compat-db installed and it picked up libdb-4.5 first
(configure list has 4.5 before just -ldb).  Removed that and it's working well,
thanks for the fix.