syncserver[4715]: Fatal error: Virtual memory exhausted

Bron Gondwana brong at fastmail.fm
Wed Apr 18 07:16:38 EDT 2007


On Tue, Apr 17, 2007 at 04:28:04PM -0400, Wesley Craig wrote:
> You probably encountered a single very large mailbox.  This patch:
> 
> --- cyrus-imapd-2.3.8/imap/sync_support.c	2006-11-30  
> 12:11:20.000000000 -0500
> +++ cyrus-imapd-2.3.8p3/imap/sync_support.c	2007-04-12  
> 13:27:49.000000000 -0400
> @@ -914,9 +914,9 @@
>      result = xzmalloc(sizeof(struct sync_message));
>      message_uuid_set_null(&result->uuid);
> 
> -    result->msg_path = xzmalloc(5 * (MAX_MAILBOX_PATH+1) * sizeof 
> (char));
> +    result->msg_path = xzmalloc((MAX_MAILBOX_PATH+1) * sizeof(char));
>      result->msg_path_end = result->msg_path +
> -	5 * (MAX_MAILBOX_PATH+1) * sizeof(char);
> +	(MAX_MAILBOX_PATH+1) * sizeof(char);
> 
>      snprintf(result->stagename, sizeof(result->stagename), "%lu.",  
> l->count);
> 
> Reduces the space that sync_server allocates when syncing a mailbox.   
> The "5 *" doesn't really do anything useful, other than waste a lot  
> of space.

That's only a factor of 5 fix.  The real problem is that there's an
unbounded stream size that will be fed into sync_server.  I have a
patch that limits it to 1000, and it's been accepted upstream since.

If you're using 2.3.8 just add:

sync_batch_size: 1000

to your imapd.conf (or any other value - this works fine for me)

The above patch is probably fine too, but I still prefer to stop the
unbounded edge case regardless.

Bron.


More information about the Info-cyrus mailing list