From: Timo Sirainen Date: Wed, 27 Feb 2013 10:34:00 +0000 (+0200) Subject: dsync: If I/O gets stalled, log the state in which it happened. X-Git-Tag: 2.2.rc3~87 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ea245d7a9683e7bb9cd74fcdf1a26d049b2947eb;p=thirdparty%2Fdovecot%2Fcore.git dsync: If I/O gets stalled, log the state in which it happened. --- diff --git a/src/doveadm/dsync/dsync-brain-mails.c b/src/doveadm/dsync/dsync-brain-mails.c index 87e5069e0d..3988400d06 100644 --- a/src/doveadm/dsync/dsync-brain-mails.c +++ b/src/doveadm/dsync/dsync-brain-mails.c @@ -8,7 +8,7 @@ #include "dsync-mailbox-export.h" #include "dsync-brain-private.h" -static const char *dsync_box_state_names[DSYNC_BOX_STATE_DONE+1] = { +const char *dsync_box_state_names[DSYNC_BOX_STATE_DONE+1] = { "mailbox", "changes", "mail_requests", diff --git a/src/doveadm/dsync/dsync-brain-private.h b/src/doveadm/dsync/dsync-brain-private.h index bf2a127e03..cafcc1dad4 100644 --- a/src/doveadm/dsync/dsync-brain-private.h +++ b/src/doveadm/dsync/dsync-brain-private.h @@ -94,6 +94,8 @@ struct dsync_brain { unsigned int failed:1; }; +extern const char *dsync_box_state_names[DSYNC_BOX_STATE_DONE+1]; + void dsync_brain_mailbox_trees_init(struct dsync_brain *brain); void dsync_brain_send_mailbox_tree(struct dsync_brain *brain); void dsync_brain_send_mailbox_tree_deletes(struct dsync_brain *brain); diff --git a/src/doveadm/dsync/dsync-brain.c b/src/doveadm/dsync/dsync-brain.c index cfca56c5b2..c702f27627 100644 --- a/src/doveadm/dsync/dsync-brain.c +++ b/src/doveadm/dsync/dsync-brain.c @@ -160,6 +160,14 @@ int dsync_brain_deinit(struct dsync_brain **_brain) *_brain = NULL; + if (dsync_ibc_has_timed_out(brain->ibc)) { + i_error("Timeout during state=%s%s", + dsync_state_names[brain->state], + brain->state != DSYNC_STATE_SYNC_MAILS ? "" : + t_strdup_printf(" (send=%s recv=%s)", + dsync_box_state_names[brain->box_send_state], + dsync_box_state_names[brain->box_recv_state])); + } if (dsync_ibc_has_failed(brain->ibc) || brain->state != DSYNC_STATE_DONE) brain->failed = TRUE; diff --git a/src/doveadm/dsync/dsync-ibc-private.h b/src/doveadm/dsync/dsync-ibc-private.h index 0871f06d04..4e155f4cea 100644 --- a/src/doveadm/dsync/dsync-ibc-private.h +++ b/src/doveadm/dsync/dsync-ibc-private.h @@ -73,6 +73,7 @@ struct dsync_ibc { void *io_context; unsigned int failed:1; + unsigned int timeout:1; }; #endif diff --git a/src/doveadm/dsync/dsync-ibc-stream.c b/src/doveadm/dsync/dsync-ibc-stream.c index bb89e8ce03..19d2d1132e 100644 --- a/src/doveadm/dsync/dsync-ibc-stream.c +++ b/src/doveadm/dsync/dsync-ibc-stream.c @@ -273,6 +273,7 @@ static void dsync_ibc_stream_timeout(struct dsync_ibc_stream *ibc) { i_error("dsync(%s): I/O has stalled, no activity for %u seconds", ibc->name, DSYNC_IBC_STREAM_TIMEOUT_MSECS/1000); + ibc->ibc.timeout = TRUE; dsync_ibc_stream_stop(ibc); } diff --git a/src/doveadm/dsync/dsync-ibc.c b/src/doveadm/dsync/dsync-ibc.c index a958923805..704f25e48b 100644 --- a/src/doveadm/dsync/dsync-ibc.c +++ b/src/doveadm/dsync/dsync-ibc.c @@ -188,6 +188,11 @@ bool dsync_ibc_has_failed(struct dsync_ibc *ibc) return ibc->failed; } +bool dsync_ibc_has_timed_out(struct dsync_ibc *ibc) +{ + return ibc->timeout; +} + bool dsync_ibc_is_send_queue_full(struct dsync_ibc *ibc) { return ibc->v.is_send_queue_full(ibc); diff --git a/src/doveadm/dsync/dsync-ibc.h b/src/doveadm/dsync/dsync-ibc.h index d3ac9037c2..ea3ba3011d 100644 --- a/src/doveadm/dsync/dsync-ibc.h +++ b/src/doveadm/dsync/dsync-ibc.h @@ -119,6 +119,7 @@ dsync_ibc_recv_mail(struct dsync_ibc *ibc, struct dsync_mail **mail_r); void dsync_ibc_close_mail_streams(struct dsync_ibc *ibc); bool dsync_ibc_has_failed(struct dsync_ibc *ibc); +bool dsync_ibc_has_timed_out(struct dsync_ibc *ibc); bool dsync_ibc_is_send_queue_full(struct dsync_ibc *ibc); bool dsync_ibc_has_pending_data(struct dsync_ibc *ibc);