On Fri, 2007-06-15 at 10:01 +0200, Erland Nylend wrote:
> On 2007-06-14, 21:53, Timo Sirainen wrote:
> > On Thu, 2007-06-14 at 15:33 +0200, Erland Nylend wrote:
> > > On 2007-06-13, 14:29, Timo Sirainen wrote:
> > > > If not, I'd have to create some debug patches to find out which function
> > > > is doing this.
> > > 
> > > I would appreciate that very much. I still see quite a few of these
> > > "unknown error" -lines in the logs .. 
> > 
> > Well, attached is the first one. When you tell me which one of those
> > functions failed I'll send another patch..
> 
> 
> It's mailbox_copy.
> 
> Jun 15 05:51:31 smtp1 deliver([EMAIL PROTECTED]): mailbox_copy() failed

OK, attached is the next one. I actually found one missing error handler
from there. Doesn't matter if you keep the previous patch or not.

> I'm also getting some "timeout while waiting for lock", and with the
> debug patch I get "mailbox_transaction_commit() failed" on those.

Those lock timeouts shouldn't happen either.. Are they separate errors
or do they happen for those that get "save failed"?

BTW. What filesystem do you use?

diff -r bbfa05cb432b src/lib-storage/mail-copy.c
--- a/src/lib-storage/mail-copy.c	Fri Jun 15 19:49:16 2007 +0300
+++ b/src/lib-storage/mail-copy.c	Sat Jun 16 01:32:12 2007 +0300
@@ -2,7 +2,7 @@
 
 #include "lib.h"
 #include "istream.h"
-#include "mail-storage.h"
+#include "mail-storage-private.h"
 #include "mail-copy.h"
 
 int mail_storage_copy(struct mailbox_transaction_context *t, struct mail *mail,
@@ -14,16 +14,20 @@ int mail_storage_copy(struct mailbox_tra
 	const char *from_envelope;
 
 	input = mail_get_stream(mail, NULL, NULL);
-	if (input == NULL)
+	if (input == NULL) {
+		i_error("copy: mail_get_stream() failed");
 		return -1;
+	}
 
 	from_envelope = mail_get_special(mail, MAIL_FETCH_FROM_ENVELOPE);
 
 	if (mailbox_save_init(t, flags, keywords,
 			      mail_get_received_date(mail),
 			      0, from_envelope, input, dest_mail != NULL,
-			      &ctx) < 0)
+			      &ctx) < 0) {
+		i_error("copy: mailbox_save_init() failed");
 		return -1;
+	}
 
 	while (i_stream_read(input) != -1) {
 		if (mailbox_save_continue(ctx) < 0)
@@ -31,9 +35,15 @@ int mail_storage_copy(struct mailbox_tra
 	}
 
 	if (input->stream_errno != 0) {
+		mail_storage_set_critical(t->box->storage,
+					  "copy: i_stream_read() failed: %m");
 		mailbox_save_cancel(&ctx);
 		return -1;
 	}
 
-	return mailbox_save_finish(&ctx, dest_mail);
+	if (mailbox_save_finish(&ctx, dest_mail) < 0) {
+		i_error("copy: mailbox_save_finish() failed");
+		return -1;
+	}
+	return 0;
 }

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to