Bug 3434

Summary: IMAP memory error
Product: Claws Mail (GTK 2) Reporter: alexander.lehmann
Component: Folders/IMAPAssignee: users
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 3.11.1   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Excerpt from the logfile
none
claws-mail --debug none

Description alexander.lehmann 2015-06-09 10:09:54 UTC
Hi,

whenever I select the INBOX folder of my mail account, I see an "IMAP error on xxx.yyy.com: memory error" in the log. Also, no new messages show up.

I can access all other folders without any problems. I've ensured that the folder is subscribed. Using other mail clients I can access the folder without any problems.

Any ideas? Is there something that I can provide you with (logs, ...)?
Comment 1 Andrej Kacian 2015-06-09 13:14:38 UTC
Hm, that's a generic error coming from libetpan - the library we use for IMAP. It mostly means "I couldn't allocate new object in memory". Is your system running out of memory, perhaps? Or do you have unusually large INBOX?
Comment 2 alexander.lehmann 2015-06-09 14:59:48 UTC
Unfortunately that doesn't seem to be the case. The inbox currently contains a mere 12 messages and the system has plenty of free memory:

              total        used        free      shared  buff/cache   available
Mem:            15G        8.0G        318M        423M        7.0G        6.6G
Swap:            0B          0B          0B

I've run claws-mail with the --debug option but wasn't able to gather further details. Also tried to delete and re-create the account, delete the cache, rebuild the folder structure, re-subscribe to all folders etc. According to our system administrator, there's also nothing special in the server logs.
Comment 3 Andrej Kacian 2015-06-09 15:51:25 UTC
What are the last few (dozens of) lines in Network Log before that error appears? That might help a little in determining what operation failed with this "memory error".
Comment 4 alexander.lehmann 2015-06-09 15:59:49 UTC
Created attachment 1512 [details]
Excerpt from the logfile
Comment 5 Andrej Kacian 2015-06-09 19:50:45 UTC
Hmm, I think a better idea would be to attach console output of a "claws-mail --debug" run from time between pressing Get Mail (or clicking INBOX, or however you initiate the IMAP connection) and getting the memory error. The content of network log are part of that, and that should get us even better idea on what command originated from which part of the code.

Sorry, I am not that familiar with internals of IMAP in Claws Mail yet and need this crutch to try to figure out which instance of imap_handle_error() from imap.c, and therefore, which IMAP operation the error comes from.

Make sure you edit out any private details from the output.
Comment 6 alexander.lehmann 2015-06-10 10:01:29 UTC
Created attachment 1513 [details]
claws-mail --debug

Thanks for taking the time to look into this matter! (And thanks for the reminder of removing all private output from the logfile. I think that's really something worth pointing out.)

I've attached the requested log. Hope it helps to reveal the culprit.
Comment 7 Andrej Kacian 2015-06-12 15:26:53 UTC
Hm, it looks like Claws Mail does not produce debug output at necessary places to catch this one. Sorry.

Do you have the capability to run claws-mail via the gdb debugger? It would help if you could set a breakpoint on function "imap_handle_error", and get a backtrace when it is reached.
Comment 8 alexander.lehmann 2015-07-01 14:02:16 UTC
Sorry, I was out of town for a couple of days. Thanks for looking into this!

Breakpoint 1, imap_handle_error (session=0xf87240, server=0x0, libetpan_errcode=7) at imap.c:610
610		const gchar *session_server = (session ? session->server : NULL);
(gdb) thread apply all bt

Thread 5 (Thread 0x7fffdc11c700 (LWP 1558)):
#0  0x00007ffff417d939 in syscall () from /usr/lib/libc.so.6
#1  0x00007ffff4a9c67a in g_cond_wait_until () from /usr/lib/libglib-2.0.so.0
#2  0x00007ffff4a2c889 in ?? () from /usr/lib/libglib-2.0.so.0
#3  0x00007ffff4a2ceab in g_async_queue_timeout_pop () from /usr/lib/libglib-2.0.so.0
#4  0x00007ffff4a7f07c in ?? () from /usr/lib/libglib-2.0.so.0
#5  0x00007ffff4a7e625 in ?? () from /usr/lib/libglib-2.0.so.0
#6  0x00007ffff57cb354 in start_thread () from /usr/lib/libpthread.so.0
#7  0x00007ffff4181bfd in clone () from /usr/lib/libc.so.6

Thread 4 (Thread 0x7fffdb91b700 (LWP 1559)):
#0  0x00007ffff4178e8d in poll () from /usr/lib/libc.so.6
#1  0x00007ffff4a57c7c in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007ffff4a58002 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#3  0x00007ffff6499876 in ?? () from /usr/lib/libgio-2.0.so.0
#4  0x00007ffff4a7e625 in ?? () from /usr/lib/libglib-2.0.so.0
#5  0x00007ffff57cb354 in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007ffff4181bfd in clone () from /usr/lib/libc.so.6

Thread 3 (Thread 0x7fffd8e39700 (LWP 1560)):
#0  0x00007ffff4178e8d in poll () from /usr/lib/libc.so.6
#1  0x00007fffda139f41 in ?? () from /usr/lib/libpulse.so.0
#2  0x00007fffda12b481 in pa_mainloop_poll () from /usr/lib/libpulse.so.0
#3  0x00007fffda12bb1e in pa_mainloop_iterate () from /usr/lib/libpulse.so.0
#4  0x00007fffda12bbd0 in pa_mainloop_run () from /usr/lib/libpulse.so.0
#5  0x00007fffda139ed6 in ?? () from /usr/lib/libpulse.so.0
#6  0x00007fffd9ccf0c8 in ?? () from /usr/lib/pulseaudio/libpulsecommon-6.0.so
#7  0x00007ffff57cb354 in start_thread () from /usr/lib/libpthread.so.0
#8  0x00007ffff4181bfd in clone () from /usr/lib/libc.so.6

Thread 2 (Thread 0x7fffc7ffe700 (LWP 1561)):
#0  0x00007ffff57d096f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007ffff4471de3 in mailsem_internal_wait () from /usr/lib/libetpan.so.17
#2  0x0000000000664d50 in thread_run (data=0xaccd10) at etpan-thread-manager.c:320
#3  0x00007ffff57cb354 in start_thread () from /usr/lib/libpthread.so.0
#4  0x00007ffff4181bfd in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7ffff7f9c940 (LWP 1544)):
#0  imap_handle_error (session=0xf87240, server=0x0, libetpan_errcode=7) at imap.c:610
#1  0x00000000004c05fa in imap_get_uncached_messages_thread (data=0xf94050) at imap.c:3512
#2  0x00000000004c0ab1 in imap_get_uncached_messages (session=0xf87240, item=0xe72100, numlist=0xf4b550, r=0x7fffffffc854) at imap.c:3637
#3  0x00000000004c34bb in imap_get_msginfos (folder=0xe02410, item=0xe72100, msgnum_list=0xf4b550) at imap.c:4685
#4  0x000000000049bc98 in get_msginfos (item=0xe72100, numlist=0xf4b550) at folder.c:2091
#5  0x000000000049c839 in folder_item_scan_full (item=0xe72100, filtering=1) at folder.c:2327
#6  0x000000000049d160 in folder_item_scan (item=0xe72100) at folder.c:2493
#7  0x00000000004abc23 in folderview_check_new (folder=0xe02410) at folderview.c:1137
#8  0x00000000004cb4f6 in inc_all_account_mail (mainwin=0xb70ea0, autocheck=1, notify=0) at inc.c:362
#9  0x00000000004cef17 in defer_check_all (data=0x1) at main.c:314
#10 0x00007ffff4a583a3 in ?? () from /usr/lib/libglib-2.0.so.0
#11 0x00007ffff4a5790d in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#12 0x00007ffff4a57ce0 in ?? () from /usr/lib/libglib-2.0.so.0
#13 0x00007ffff4a58002 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#14 0x00007ffff7280467 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#15 0x00000000004d165d in main (argc=1, argv=0x7fffffffdf38) at main.c:1559