Here is a bunch of attachments.

1) original message
2) messages as contained in the database, with the binary chars
3) imap trace of retreival.







Ilja Booij wrote:
Hi all,

we should still resolve the bug that causes IMAP messages to parse badly
(resulting in empty messages or errors).  I still need more info on when
things wrong. Can people who have had the problem please post some
traces and the raw messages. I'd like to be able to see a trace of the
message being inserted, and and a trace of the IMAP server trying to
retreive the message.

Oh, and please update to current CVS, to make sure we're working on the
same code. :)

Thanks,
Ilja

On Mon, 2004-04-05 at 12:07, Ilja Booij wrote:

Paul J Stevens wrote:


Here's a suspect line possibly responsible for the binary chars in messageblks.


in db.c,db_insert_message_block_physmessage line 856:

       escaped_query = (char *) my_malloc(sizeof(char) * maxesclen);

I don't see a:

   memset(escaped_query,'\0',sizeof(char) * maxesclen);

around.

I don't think this causes the malfunction. The escaped_query string is printed to by snprintf() which adds a '\0' to the end. This last character is then overwritten by db_escape_query(), adding another '\0', which is again overwritten by the last snprintf(), which adds the last '\0'. So, the string is always terminated. I did add the memset() call though, because that should make it a lot safer to change this function in the future. And besides, it's just good practice to NULL all strings before using them.

Ilja

_______________________________________________
Dbmail-dev mailing list
[email protected]
http://twister.fastxs.net/mailman/listinfo/dbmail-dev



_______________________________________________
Dbmail-dev mailing list
[email protected]
http://twister.fastxs.net/mailman/listinfo/dbmail-dev


--
  ________________________________________________________________
  Paul Stevens                                         [EMAIL PROTECTED]
  NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
  The Netherlands_______________________________________www.nfg.nl
Message-ID: <[EMAIL PROTECTED]>
Date: Thu, 01 Apr 2004 16:54:11 +0200
From: Paul J Stevens <[EMAIL PROTECTED]>
User-Agent: Mozilla Thunderbird 0.5 (X11/20040306)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: DBMAIL Developers Mailinglist <[email protected]>
Subject: Re: [Dbmail-dev] list crash
References: <[EMAIL PROTECTED]>,        <[EMAIL PROTECTED]>     <[EMAIL 
PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL 
PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL 
PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL 
PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL 
PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL 
PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL 
PROTECTED]> <[EMAIL PROTECTED]>
In-Reply-To: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Great.

No more sigpipes here :-)

Ilja Booij wrote:
> Paul J Stevens wrote:
> 
>> You're probably correct here. Resource allocation/deallocation is 
>> still mostly unexplored territory for me.  I've tried to be really 
>> carefull in leaving all cleanup actions in place, even though moving 
>> most of them to a separate imap_cleanup function. Some leaks are still 
>> there, but exposing them was part of my motivation for writing that 
>> patch. Looks to me like adding some calls to imap_cleanup here and 
>> there in ImapClientHandler should do the trick.
> 
> 
> I've committed the ci_write() patch (for lack of a better name..) and 
> added some more ci_cleanup() calls in the appropriate places. It seems 
> to work OK here. I don't have any memleaks here in my test runs (using 
> valgrind to spot mem-leaks and other memory errors)
> 
> Paul, can you test it on your machines?
> 
> Ilja
> 
> _______________________________________________
> Dbmail-dev mailing list
> [email protected]
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
> 

-- 
   ________________________________________________________________
   Paul Stevens                                  mailto:[EMAIL PROTECTED]
   NET FACILITIES GROUP                     PGP: finger [EMAIL PROTECTED]
   The Netherlands________________________________http://www.nfg.nl

From [EMAIL PROTECTED]  Thu Apr  1 16:54:19 2004
Return-Path: <[EMAIL PROTECTED]>
X-Original-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Received: from localhost (localhost [127.0.0.1])
        by tsuki.nfg.nl (Postfix) with ESMTP id 266105C034
        for <[EMAIL PROTECTED]>; Thu,  1 Apr 2004 16:54:19 +0200 (CEST)
Received: from tsuki.nfg.nl ([127.0.0.1])
        by localhost (tsuki [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
        id 01507-07 for <[EMAIL PROTECTED]>;
        Thu, 1 Apr 2004 16:54:17 +0200 (CEST)
Received: from sr2.nfgs.net (sr2.nfgs.net [194.109.214.202])
        by tsuki.nfg.nl (Postfix) with ESMTP id A845A5C032
        for <[EMAIL PROTECTED]>; Thu,  1 Apr 2004 16:54:17 +0200 (CEST)
Received: by sr2.nfgs.net (Postfix)
        id 69CAF2799A; Thu,  1 Apr 2004 16:54:17 +0200 (CEST)
Delivered-To: [EMAIL PROTECTED]
Received: from elnino.fastxs.net (twister.fastxs.net [213.214.98.20])
        by sr2.nfgs.net (Postfix) with ESMTP id D1F5827998
        for <[EMAIL PROTECTED]>; Thu,  1 Apr 2004 16:54:16 +0200 (CEST)
Received: from elnino (elnino [127.0.0.1])
        by elnino.fastxs.net (Postfix) with ESMTP
        id D746224052; Thu,  1 Apr 2004 16:54:15 +0200 (CEST)
Received: from tsuki.nfg.nl (nfg3.nfgs.net [80.126.246.87])
        by elnino.fastxs.net (Postfix) with ESMTP id A12AD24055
        for <[email protected]>; Thu,  1 Apr 2004 16:54:13 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
        by tsuki.nfg.nl (Postfix) with ESMTP id 09B995C034
        for <[email protected]>; Thu,  1 Apr 2004 16:54:13 +0200 (CEST)
Received: from tsuki.nfg.nl ([127.0.0.1])
        by localhost (tsuki [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
        id 11798-03 for <[email protected]>;
        Thu, 1 Apr 2004 16:54:11 +0200 (CEST)
Received: from nfg.nl (helpoort.xs4all.nl [213.84.166.133])
        by tsuki.nfg.nl (Postfix) with ESMTP id 976385C032
        for <[email protected]>; Thu,  1 Apr 2004 16:54:11 +0200 (CEST)
Message-ID: <[EMAIL PROTECTED]>
Date: Thu, 01 Apr 2004 16:54:11 +0200
From: Paul J Stevens <[EMAIL PROTECTED]>
User-Agent: Mozilla Thunderbird 0.5 (X11/20040306)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: DBMAIL Developers Mailinglist <[email protected]>
Subject: Re: [Dbmail-dev] list crash
References: <[EMAIL PROTECTED]>,
        <[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     
<[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL 
PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL 
PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL 
PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL 
PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL PROTECTED]>     <[EMAIL 
PROTECTED]>     <[EMAIL PROTECTED]>
        <[EMAIL PROTECTED]>
In-Reply-To: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at nfg.nl
X-BeenThere: [email protected]
X-Mailman-Version: 2.1.4
Reply-To: DBMAIL Developers Mailinglist <[email protected]>
List-Id: DBMAIL Developers Mailinglist <dbmail-dev.dbmail.org>
List-Help: <mailto:[EMAIL PROTECTED]>
List-Post: <mailto:[email protected]>
List-Subscribe: <http://twister.fastxs.net/mailman/listinfo/dbmail-dev>,
        <mailto:[EMAIL PROTECTED]>
List-Archive: <http://twister.fastxs.net/pipermail/dbmail-dev>
List-Unsubscribe: <http://twister.fastxs.net/mailman/listinfo/dbmail-dev>,
        <mailto:[EMAIL PROTECTED]>
Sender: [EMAIL PROTECTED]
Errors-To: [EMAIL PROTECTED]
X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at nfg.nl
X-Bogosity: No, tests=bogofilter, spamicity=0.000000, version=0.17.2

Great.

No more sigpipes here :-)

Ilja Booij wrote:
> Paul J Stevens wrote:
> 
>> You're probably correct here. Resource allocation/deallocation is 
>> still mostly unexplored territory for me.  I've tried to be really 
>> carefull in leaving all cleanup actions in place, even though moving 
>> most of them to a separate imap_cleanup function. Some leaks are still 
>> there, but exposing them was part of my motivation for writing that 
>> patch. Looks to me like adding some calls to imap_cleanup here and 
>> there in ImapClientHandler should do the trick.
> 
> 
> I've committed the ci_write() patch (for lack of a better name..) and 
> added some more ci_cleanup() calls in the appropriate places. It seems 
> to work OK here. I don't have any memleaks here in my test runs (using 
> valgrind to spot mem-leaks and other memory errors)
> 
> Paul, can you test it on your machines?
> 
> Ilja
> 
> _______________________________________________
> Dbmail-dev mailing list
> [email protected]
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
> 

-- 
   ________________________________________________________________
   Paul Stevens                                  mailto:[EMAIL PROTECTED]
   NET FACILITIES GROUP                     PGP: finger [EMAIL PROTECTED]
   The Netherlands________________________________http://www.nfg.nl
_______________________________________________
Dbmail-dev mailing list
[email protected]
http://twister.fastxs.net/mailman/listinfo/dbmail-dev

Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: IMAPClientHandler(): line read for 
PID 14851
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: COMMAND: [6 UID fetch 311021 (UID 
RFC822.SIZE BODY[])]
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: arg[0]: 'fetch'
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: arg[1]: '311021'
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: arg[2]: '('
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: arg[3]: 'UID'
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: arg[4]: 'RFC822.SIZE'
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: arg[5]: 'BODY'
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: arg[6]: '['
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: arg[7]: ']'
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: arg[8]: ')'
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: IMAPClientHandler(): Executing 
command uid...
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: db.c,db_acl_has_right: checking ACL 
for user [1] on mailbox [593]
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: dbmysql.c,db_query: executing query 
[SELECT mailbox_idnr FROM mailboxes WHERE mailbox_idnr = '593' AND owner_idnr = 
'1']
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: next_fetch_item(): args[idx = 2] = 
UID (returning 3)
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: next_fetch_item(): args[idx = 3] = 
RFC822.SIZE (returning 4)
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: Fetching msgID 311021 (fetch num 
311022)
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: dbmysql.c,db_query: executing query 
[SELECT pm.rfcsize FROM physmessage pm, messages msg WHERE pm.id = 
msg.physmessage_id AND msg.message_idnr = '311021' AND msg.status< '2' AND 
msg.unique_id != '' AND msg.mailbox_idnr = '593']
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: dbmysql.c,db_query: executing query 
[SELECT physmessage_id FROM messages WHERE message_idnr = '311021']
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: dbmysql.c,db_query: executing query 
[SELECT messageblk FROM messageblks WHERE physmessage_id = '299658' ORDER BY 
messageblk_idnr]
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: db_start_msg(): starting, 
stopbound: '<null>'
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: mime_readheader(): entering mime 
loop
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: mime_readheader(): found double 
newline; header size: 67 lines
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: db_start_msg(): found singlepart msg
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: dbmsgbuf.c,db_update_msgbuf: update 
msgbuf_buf updating 131072, 5332, 1487, 1487
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: dbmsgbuf.c,db_update_msgbuf: update 
msgbuf: entire fit
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: dbmsgbuf.c,db_update_msgbuf update 
msgbuf succes NOMORE
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: db_start_msg(): exit
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: dbmysql.c,db_query: executing query 
[SELECT physmessage_id FROM messages WHERE message_idnr = '311021']
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: dbmsgbuf.c,db_dump_range: Dumping 
range: (0,3828) - (0,3828)
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: dbmysql.c,db_query: executing query 
[SELECT messageblk FROM messageblks WHERE physmessage_id = '299658' ORDER BY 
messageblk_idnr]
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: dbmysql.c,db_query: executing query 
[SELECT seen_flag FROM messages WHERE message_idnr = '311021' AND status< '2' 
AND unique_id != '' AND mailbox_idnr = '593']
Apr 14 10:44:02 tsuki dbmail/imap4d[14851]: IMAPClientHandler(): Finished 
command uid

Reply via email to