The problem is more easily introduced than I imagined.

Included attached is an example mailbox containing just 3 mails.
Use it to make a couple of POP sessions. Make sure indexes are generated for it by setting appropriately mbox_min_index_size
e.g. mbox_min_index_size = 2k

Now, in the first session just generate the indexes and quit

kzorba@enigma(1)[05:23 PM]~->telnet dovecot-dev 110
Trying <IP>...
Connected to dovecot-dev.
Escape character is '^]'.
+OK OTENET ready
user kzorba1
+OK
pass XXXXXXX
+OK Logged in.
LIST
+OK 3 messages:
1 812
2 821
3 816
.
quit
+OK Logging out.
Connection closed by foreign host.

In the second session we LIST and try to DELE a message

kzorba@enigma(1)[05:25 PM]~->telnet dovecot-dev 110
Trying <IP>...
Connected to dovecot-dev.
Escape character is '^]'.
+OK OTENET ready
user kzorba1
+OK
pass XXXXXXX
+OK Logged in.
LIST
+OK 3 messages:
1 812
2 821
3 816
.
dele 2
+OK Marked to be deleted.
quit
Connection closed by foreign host.

In the server logs we get
Aug 19 17:25:24 dovecot dovecot: master: Error: service(pop3): child 3489 
killed with signal 11 (core dumped)

With the backtrace:

#0  0x00002b9ca3e93dce in istream_raw_mbox_get_start_offset (stream=0x0) at 
istream-raw-mbox.c:498
#1  0x00002b9ca3e97956 in mbox_mail_get_special (_mail=0x101cf7d0, 
field=MAIL_FETCH_GUID, value_r=0x7fff1fd69798) at mbox-mail.c:198
#2  0x00002b9ca3e47729 in mail_get_special (mail=0x101cf7d0, 
field=MAIL_FETCH_GUID, value_r=0x7fff1fd69798) at mail.c:188
#3  0x00002b9ca3e6d133 in index_mail_expunge (mail=0x101cf7d0) at 
index-mail.c:1503
#4  0x00002b9ca3e4784d in mail_expunge (mail=0x101cf7d0) at mail.c:233
#5  0x0000000000406272 in client_update_mails (client=0x101baa00) at 
pop3-commands.c:255
#6  0x000000000040635a in cmd_quit (client=0x101baa00, args=0x407f62 "") at 
pop3-commands.c:274
#7  0x000000000040774a in client_command_execute (client=0x101baa00, name=0x101960c0 
"QUIT", args=0x407f62 "") at pop3-commands.c:773
#8  0x000000000040567c in client_handle_input (client=0x101baa00) at 
pop3-client.c:628
#9  0x0000000000405870 in client_input (client=0x101baa00) at pop3-client.c:681
#10 0x00002b9ca418af83 in io_loop_call_io (io=0x101b61d0) at ioloop.c:384
#11 0x00002b9ca418c685 in io_loop_handler_run (ioloop=0x1019e610) at 
ioloop-epoll.c:213
#12 0x00002b9ca418b024 in io_loop_run (ioloop=0x1019e610) at ioloop.c:405
#13 0x00002b9ca4171ca2 in master_service_run (service=0x1019e4e0, callback=0x403bab 
<client_connected>) at master-service.c:478
#14 0x0000000000403e14 in main (argc=1, argv=0x1019e370) at main.c:252

I guess something is wrong in the indexing code because if I disable the index 
creation
using an appropriate value for mbox_min_index_size everything works as expected 
and
mails are deleted.

In our case, all clients that leave messages on server cannot actually delete 
messages
from their inboxes. Clients with Thunderbird, keep getting the mails after they
delete them, customers with Outlook don't see them again, but the deleted 
messages
remain in the server. Needless to say that I will try to provide a patch but
it will take me far more time than any developer familiar with the code already.

Regards,

Kostas

From kzo...@otenet.gr Fri Jun 24 15:40:59 2011
X-UIDL: ~&c!!/(1"!JG4!!T&0!!
Return-Path: <kzo...@otenet.gr>
Received: from noc.otenet.gr (noc.otenet.gr [195.170.0.29])
        by speedy.otenet.gr (8.13.8/8.13.8/Debian-3) with ESMTP id 
p5OCexJ7025830;
        Fri, 24 Jun 2011 15:40:59 +0300
Received: from [212.205.221.137] (enigma.otenet.gr [212.205.221.137])
        by noc.otenet.gr (Postfix) with ESMTP id 8D4F68B81C7;
        Fri, 24 Jun 2011 15:40:59 +0300 (EEST)
Message-ID: <4e04867b.3000...@otenet.gr>
Date: Fri, 24 Jun 2011 15:43:39 +0300
From: Kostas Zorbadelos <kzo...@otenet.gr>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) 
Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10
MIME-Version: 1.0
To: kzor...@otenet.gr
Subject: Test receive
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IMAPbase: 1140602935 0000000477 Old
X-UID: 475
Status: RO
X-Keywords: Old                                                  

Test it.

From kzo...@otenet.gr Fri Jun 24 16:16:44 2011
X-UIDL: D[H"!e^Q!!0=:"!=G,"!
Return-Path: <kzo...@otenet.gr>
Received: from noc.otenet.gr (noc.otenet.gr [195.170.0.29])
        by speedy.otenet.gr (8.13.8/8.13.8/Debian-3) with ESMTP id 
p5ODGhv9024786;
        Fri, 24 Jun 2011 16:16:43 +0300
Received: from [212.205.221.137] (enigma.otenet.gr [212.205.221.137])
        by noc.otenet.gr (Postfix) with ESMTP id C57AB8B81F2;
        Fri, 24 Jun 2011 16:16:43 +0300 (EEST)
Message-ID: <4e048edc.1090...@otenet.gr>
Date: Fri, 24 Jun 2011 16:19:24 +0300
From: Kostas Zorbadelos <kzo...@otenet.gr>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) 
Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10
MIME-Version: 1.0
To: kzor...@otenet.gr
Subject: Test receive 2
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Status: RO
X-UID: 476                                                  

Gia na doume...

From kzor...@otenet.gr Fri Aug 19 17:44:49 2011
Return-Path: <kzor...@otenet.gr>
Received: from sphinx.otenet.gr (sphinx.otenet.gr [83.235.69.19])
        by rigel.otenet.gr (8.13.8/8.13.8) with ESMTP id p7JEimb5029997
        for <kzor...@otenet.gr>; Fri, 19 Aug 2011 17:44:48 +0300
Received: from [212.205.221.137] (enigma.otenet.gr [212.205.221.137])
        by sphinx.otenet.gr (ESMTP) with ESMTPSA
        for <kzor...@otenet.gr>; Fri, 19 Aug 2011 17:44:48 +0300 (EEST)
Message-ID: <4e4e7705.8020...@otenet.gr>
Date: Fri, 19 Aug 2011 17:45:25 +0300
From: kzorba1 <kzor...@otenet.gr>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) 
Gecko/20110617 Lightning/1.0b2 Thunderbird/3.1.11
MIME-Version: 1.0
To: kzor...@otenet.gr
Subject: Another test mail
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

A simple test

Reply via email to