[Dovecot] Assertion Failure in mbox-sync.c

Timo Sirainen tss at iki.fi
Tue May 17 12:13:11 EEST 2005


On Mon, 2005-05-16 at 19:39 -0400, Todd Burroughs wrote:
> dovecot: May 16 17:41:07 Error:  20973 IMAP(todd.bluegenesis.com): file mbox-sync.c: line 1165 (mbox_sync_handle_eof_updates): assertion failed: (file_size >= sync_ctx->file_input->v_offset)
..
> (gdb) p sync_ctx->input->real_stream->statbuf
> $5 = {st_dev = 0, __pad1 = 0, __st_ino = 0, st_mode = 0, st_nlink = 0,
>    st_uid = 0, st_gid = 0, st_rdev = 0, __pad2 = 0, st_size = 4294967295,
>    st_blksize = 0, st_blocks = 0, st_atim = {tv_sec = 1116279667, tv_nsec = 0},
>    st_mtim = {tv_sec = 1116279667, tv_nsec = 0}, st_ctim = {
>      tv_sec = 1116279667, tv_nsec = 0}, st_ino = 0}

sync_ctx->input is different than sync_ctx->file_input, where the
statbuf was taken from (took a while to notice this :). Could you do the
same for it?

> (gdb) p sync_ctx->file_input->v_offset
> $8 = 142294527
> 
> The mbox size is larger than 142294527

But it crashes because fstat() returns a value smaller than that as the
mbox's size. Maybe NFS returns some old size from cache? I don't really
know how NFS caching usually works. If someone has any pointers (other
than kernel sources :) it'd be helpful.

What OS are you using on NFS client side?

How about if you try running this little program, does it work:

/* gcc writetest.c -o writetest -Wall */
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>

int main(void)
{
	int fd = open("writetest.tmp", O_RDWR | O_CREAT | O_TRUNC, 0600);
	char buf[1024];
	struct stat st;
	int x, ret;

	if (fd < 0) {
		perror("open()");
		return 1;
	}

	fstat(fd, &st);

	for (x = 0; x < 100; x++) {
		ret = write(fd, buf, sizeof(buf));
		if (ret != sizeof(buf)) {
			perror("write()");
			return 1;
		}
	}

	fstat(fd, &st);
	printf("size again: %ld vs. %d\n", st.st_size, 100*sizeof(buf));

	ret = write(fd, buf, sizeof(buf));
	if (ret != sizeof(buf)) {
		perror("write()");
		return 1;
	}

	fstat(fd, &st);
	printf("size finally: %ld vs. %d\n", st.st_size, 101*sizeof(buf));
	return 0;
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://dovecot.org/pipermail/dovecot/attachments/20050517/d12ccb75/attachment-0001.bin>


More information about the dovecot mailing list