zmmailbox : Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Ask questions about your setup or get help installing ZCS server (ZD section below).
Leeloo
Posts: 11
Joined: Thu Apr 24, 2025 2:16 pm

Re: zmmailbox : Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Post by Leeloo »

Hello,


Thank you for your feedback ;)


Does this curl command do what zmmailbox does in the end?
Does it produce the same archive?

I asked support if other people had reported the same behaviour with zmmailbox, but they didn't reply on this point, but it seems to be the case.

What distribution do you use?
And what's the main reason why you're sticking with zmmailbox? Just asking for information.


Thanks
teyxwhat
Posts: 2
Joined: Mon Jun 10, 2019 2:40 pm

Re: zmmailbox : Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Post by teyxwhat »

As far as I know it gives the same output as running the export in the GUI.

tried importing the export file, the folders and message counts are intact. Good enough for our purposes.

We started seeing the issue when we upgraded to Release 10.1.8.GA.4655.UBUNTU22_64 NETWORK edition from 10.0.14 Ubuntu 20

We use it to make a copy of an account before deleting.
If there's a better way, please let me know.
Leeloo
Posts: 11
Joined: Thu Apr 24, 2025 2:16 pm

Re: zmmailbox : Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Post by Leeloo »

Hello,

Thank you for your reply.

How do you import the account (the mailbox export data), also with CURL?

Thank you.
MarkDavis
Posts: 1
Joined: Sat Jun 28, 2025 11:06 am

Re: zmmailbox : Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Post by MarkDavis »

This error usually means the Java process doesn’t have enough memory allocated. You can resolve it by increasing the heap size using flags like -Xmx2g (for 2GB) when running the zmmailbox command. Make sure your system has enough available RAM.
Copyright
Posts: 7
Joined: Thu Nov 07, 2019 4:02 pm

Re: zmmailbox : Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Post by Copyright »

Had the same issue. Solve it by incrasing Xmx in zmlocalconfig zimbra_zmjava_options

You can check the Xmx:
su - zimbra -c 'zmlocalconfig zimbra_zmjava_options'

And incrase it:
su - zimbra -c 'zmlocalconfig -e zimbra_zmjava_options="-Xmx1024m <other_options>"'
Klug
Ambassador
Ambassador
Posts: 2932
Joined: Mon Dec 16, 2013 11:35 am
Location: France - Drôme
ZCS/ZD Version: All of them
Contact:

Re: zmmailbox : Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Post by Klug »

akanellis
Posts: 14
Joined: Fri Jun 13, 2025 12:48 pm

Re: zmmailbox : Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Post by akanellis »

After upgrading to 10.1.7 FOSS I have also noticed that the automated backups on my servers don't work anymore for all accounts. I was also using zmmailbox to do the actual backup.

I have tried changing -Xmx to 2G (the default value was 256m) and it didn't help. I'm not increasing it more even though most of the servers have 16+ GB of ram because it's eating the ram like it's gasoline on a Bugatti Veyron. Some accounts were backed up but some large ones (100+ GB size) returned 0 bytes size.

The only thing that worked was the curl method and I have updated all my backup scripts to use this instead.
Leeloo wrote: Thu Jun 26, 2025 7:45 am How do you import the account (the mailbox export data), also with CURL?
You can use this method: https://wiki.zimbra.com/wiki/Import_mai ... using_curl
mocha
Posts: 23
Joined: Wed Oct 19, 2022 10:16 am

Re: zmmailbox : Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Post by mocha »

In case you’re wondering, the official support answer is:

“Zimbra doesn’t support export-import of large mailboxes in TGZ because of broken TGZ files and other I/O errors.”

and they recommend using CURL instead. Apparently, a 1 GB mailbox counts as “large” now. :lol:
Post Reply