segfault in mailmbox_append_message_list_no_lock / mmap full mbox

Florian Lohoff <[email protected]> Sat, 4 Mar 2006 18:59:29 +0100
Newsgroups gmane.mail.libetpan.user
Organization rfc822 - pure communication
Message-ID <[email protected]>
Hi,
i am getting segfaults in mailmbox_append_message_list_no_lock with a
simple application of mine copying folder contents from maildir to an
mbox. This does happen irregularly so i compiled libetpan with debugging
symbols and let it run. Over the day it copied 66k mails to the mbox 
before crashing.

strap@hydra:~/Mail/arch$ grep "^From " 20060304 | wc -l
66516
strap@hydra:~/Mail/arch$ ls -la 20060304
-rw-------  1 strap strap 1083389734 Mar  4 18:50 20060304

Core was generated by `/home/strap/bin/copyfolder -i /home/strap/Mail/in/20060304/ -o /home/strap/Mail'.
Program terminated with signal 11, Segmentation fault.

warning: current_sos: Can't read pathname for load map: Input/output error

Reading symbols from /usr/lib/liblockfile.so.1...done.
Loaded symbols for /usr/lib/liblockfile.so.1
Reading symbols from /usr/lib/libdb-4.2.so...done.
Loaded symbols for /usr/lib/libdb-4.2.so
Reading symbols from /lib/tls/libc.so.6...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0  0xb7e4e077 in memcpy () from /lib/tls/libc.so.6
(gdb) bt
#0  0xb7e4e077 in memcpy () from /lib/tls/libc.so.6
#1  0x08052b31 in mailmbox_append_message_list_no_lock (folder=0x8085210,
    append_tab=0x8755dc0) at mailmbox.c:717
#2  0x08052c66 in mailmbox_append_message_list (folder=0x8085210,
    append_tab=0x8755dc0) at mailmbox.c:763
#3  0x08052d73 in mailmbox_append_message_uid (folder=0x8085210,
    data=0x8759608 "Return-Path: <[email protected]>\nX-Original-To: strap\nDelivered-To: [email protected]\nReceived: by hydra.gt.owl.de (Postfix, from userid 1016)\n\tid 01907199148; Sat,  4 Mar 2006 18:28:52 +0100"...,
    len=26348, puid=0x0) at mailmbox.c:816
#4  0x08052dfd in mailmbox_append_message (folder=0x8085210,
    data=0x8759608 "Return-Path: <[email protected]>\nX-Original-To: strap\nDelivered-To: [email protected]\nReceived: by hydra.gt.owl.de (Postfix, from userid 1016)\n\tid 01907199148; Sat,  4 Mar 2006 18:28:52 +0100"...,
    len=26348) at mailmbox.c:838
#5  0x0805f7f4 in mboxdriver_append_message (session=0x8076e50,
    message=0x8759608 "Return-Path: <[email protected]>\nX-Original-To: strap\nDelivered-To: [email protected]\nReceived: by hydra.gt.owl.de (Postfix, from userid 1016)\n\tid 01907199148; Sat,  4 Mar 2006 18:28:52 +0100"...,
    size=26348) at mboxdriver.c:397
#6  0x0805f840 in mboxdriver_append_message_flags (session=0x8076e50,
    message=0x8759608 "Return-Path: <[email protected]>\nX-Original-To: strap\nDelivered-To: [email protected]\nReceived: by hydra.gt.owl.de (Postfix, ---Type <return> to continue, or q <return> to quit---
from userid 1016)\n\tid 01907199148; Sat,  4 Mar 2006 18:28:52 +0100"...,
    size=26348, flags=0x8758bc8) at mboxdriver.c:410
#7  0x0804b1bc in mailsession_append_message_flags (session=0x8076e50,
    message=0x8759608 "Return-Path: <[email protected]>\nX-Original-To: strap\nDelivered-To: [email protected]\nReceived: by hydra.gt.owl.de (Postfix, from userid 1016)\n\tid 01907199148; Sat,  4 Mar 2006 18:28:52 +0100"...,
    size=26348, flags=0x8758bc8) at maildriver.c:318
#8  0x0804b72b in mailfolder_append_message_flags (folder=0x8076be0,
    message=0x8759608 "Return-Path: <[email protected]>\nX-Original-To: strap\nDelivered-To: [email protected]\nReceived: by hydra.gt.owl.de (Postfix, from userid 1016)\n\tid 01907199148; Sat,  4 Mar 2006 18:28:52 +0100"...,
    size=26348, flags=0x8758bc8) at mailfolder.c:76
#9  0x08049cc9 in copybox (inbox=0x8075008 "/home/strap/Mail/in/20060304/",
    outbox=0x8075030 "/home/strap/Mail/arch/20060304",
    hdrfile=0x8075058 "/home/strap/Mail/arch/20060304.200603041830.hdr",
    delete=1) at copyfolder.c:95
#10 0x08049f9b in main (argc=8, argv=0xbffffde4) at copyfolder.c:175
(gdb)
(gdb) frame 1
#1  0x08052b31 in mailmbox_append_message_list_no_lock (folder=0x8085210,
    append_tab=0x8755dc0) at mailmbox.c:717
717         memcpy(str, from_line, from_size);
(gdb) print from_line
$1 = "From - Sat Mar  4 18:34:52 2006\n", '\0' <repeats 223 times>
(gdb) print from_size
$2 = 32
(gdb) print str
$3 = 0x3f412e79 <Address 0x3f412e79 out of bounds>


It seems the mbox mmap does not succeed but still continues. Anyway - I
guess so far libetpan is the wrong library for me because i am expecting
mailfolder much larger than 2GB (for archive reasons) and i see the
mailmbox_map mmaps the full file which wont work on 32bit archs anyway.

Flo
-- 
Florian Lohoff                  [email protected]             +49-171-2280134
                        Heisenberg may have been here.
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFECdWBUaz2rXW+gJcRAkhVAKDCTIGPcE9SF7/02qr+2aGir2+FBQCgw/jQ
G9Dwl3ROn238skejxCH5VXI=
=E4k5
-----END PGP SIGNATURE-----