if (_mail->expunged)
return;
}
- mail_set_critical(_mail,
- "read(%s) failed: %s (read reason=%s)",
- i_stream_get_name(input), i_stream_get_error(input),
+
+ const char *old_error =
+ mailbox_get_last_internal_error(_mail->box, NULL);
+ const char *new_error = t_strdup_printf("read(%s) failed: %s",
+ i_stream_get_name(input), i_stream_get_error(input));
+
+ if (mail->data.istream_error_logged &&
+ strstr(old_error, new_error) != NULL) {
+ /* Avoid logging the same istream error multiple times
+ (even if the read reason is different). The old_error begins
+ with the UID=n prefix, which we can ignore since we know
+ that this mail already logged a critical error, so it has
+ to be about this same mail. */
+ return;
+ }
+ mail->data.istream_error_logged = TRUE;
+ mail_set_critical(_mail, "%s (read reason=%s)", new_error,
mail->mail.get_stream_reason == NULL ? "" :
mail->mail.get_stream_reason);
}
bool header_parsed:1;
bool no_caching:1;
bool forced_no_caching:1;
+ bool istream_error_logged:1;
bool destroying_stream:1;
bool initialized_wrapper_stream:1;
bool destroy_callback_set:1;