===== ISSUE: java.lang.OutOfMemoryError: Java heap space error when performing an Office 365 backup ===== Article ID: 8027
Reviewed: 04/08/2020

Product Version:
AhsayCBS / AhsayOBM: 8.1.0.0 - 8.3.2.200
OS: All platforms ===== Problem Description ===== When performing an Office 365 Run on Server backup, the backup job and the AhsayCBS service stopped responding. The following info message is received in the backup report:
No. Type Timestamp Log
* ... ... ...
* info ... Finished running pre-commands
* info ... ...
* info YYYY/MM/DD hh:mm:ss Sleep 20000 for next retry... (Connect to server.sharepoint.com:443 [server.sharepoint.com/xx.xx.xx.xx]
timed out)
* ... ... ...
Further checking on the context logs (e.g. cbs_context_YYYY-MM-DD.log / obs_context_YYYY-MM-DD.log), the following error messages are displayed:

DD-MMM-YYYY hh:mm:ss.xxx SEVERE [https-openssl-nio-0.0.0.0-443-exec-107] org.apache.catalina.core.ApplicationContext.log java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space

or

DD-MMM-YYYY hh:mm:ss.xxx SEVERE [[Job][ScheduleBackup]] org.apache.catalina.core.ApplicationContext.log [Job] java.lang.OutOfMemoryError: Java heap space
DD-MMM-YYYY hh:mm:ss.xxx SEVERE [https-openssl-nio-0.0.0.0-443-exec-117] org.apache.catalina.core.ApplicationContext.log [LogInfo] java.lang.OutOfMemoryError: Java heap space
DD-MMM-YYYY hh:mm:ss.xxx SEVERE [[Job][MigrateV6File]] org.apache.catalina.core.ApplicationContext.log [Job] java.lang.OutOfMemoryError: Java heap space
DD-MMM-YYYY hh:mm:ss.xxx SEVERE [[Job][ScheduleBackup]] org.apache.catalina.core.ApplicationContext.log [Job] java.lang.OutOfMemoryError: Java heap space
DD-MMM-YYYY hh:mm:ss.xxx SEVERE [https-openssl-nio-0.0.0.0-443-exec-63] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [OBC v7 REST Service] in context with path [/obs] threw exception [java.lang.OutOfMemoryError: Java heap space] with root cause java.lang.OutOfMemoryError: Java heap space


The same issue can also occur for an Office 365 Run on Client backup. The following error message is received in the backup report:

No. Type Timestamp Log
* ... ... ...
* info ... Start running post-commands
* ... ... ...
* erro YYYY/MM/DD hh:mm:ss [BackupIpcThread.doRunException] error: java.lang.OutOfMemoryError: Java heap space Message:      
Java heap space
* ... ... ...
Note:
For a Office 365 Run on Client backup, the AhsayCBS services will not be affected. ===== Cause ===== The message suggests that the AhsayCBS server or AhsayOBM client application had ran out of memory during the backup process. ===== Resolution ===== For Office 365 backup with OneDrive or Site Collections / Personal Site(s) selected for backup, extra memory must be allocated for the AhsayCBS server application (for Run on Server backup set) or AhsayOBM client application (for Run on Client backup set).

The memory requirement is dependent on the number of OneDrive or Site Collections / Personal Site(s) selected for backup. It is recommended to allocate 100 MB per OneDrive account, and 150 MB per Site Collections / Personal Site selected for backup.

Example 1
For a Run on Server Office 365 backup set with 100 Site Collections selected for backup, 15 GB (150 MB * 100) of memory is required for the backup operation.

An additional 2 - 4 GB are recommended for the AhsayCBS server operation.  Therefore, the Java heap size setting of the AhsayCBS server should be set to at least 18 GB.

Example 2
For a Run on Client Office 365 backup set with 80 Personal Sites and 100 OneDrive accounts selected for backup, 22 GB ((150 MB * 80) + (100 MB * 100)) of memory is required for the backup operation.

The Java heap size setting of the AhsayOBM client should be set to 22 GB.

For instruction on how to modify the Java heap size setting for your AhsayCBS server application / AhsayOBM client application, please refer to the following articles for details:

FAQ: How to modify the Java heap size of AhsayCBS?
FAQ: How to modify the Java heap size of AhsayOBM / AhsayACB?

Note:
The Java heap size to be configured should not exceed 2/3 of RAM available, to allow sufficient resources for the operating system. ===== Keywords ===== o365, cbs, heap, java, memory