Error: An unexpected error has occurred while maintaining the GeoFence Synchronization. Error: Java heap space
Importing a lot of geometries as GeoFences results in high memory consumption by Java JVM process and results in an out-of-memory error in ArcGIS GeoEvent Processor 10.3 logs.
Importing many GeoFences in GeoEvent Processor 10.3 overloads the Java JVM process memory and generates the following error in karaf.log:
"java.lang.OutOfmemoryError: Java heap space"
"An unexpected error has occurred while maintaining the GeoFence Synchronization. Error: Java heap space."
In ArcGIS GeoEvent Processor 10.3, all the GeoFences are stored in-memory which radically improves the GeoFence potential in terms of processing high-volume data, while conducting the processing required for spatial comparisons.
The downside to this design is that the more complex and numerous the GeoFences are, the more JVM memory they consume. At some point they exceed the default 4GB limit the product ships with and log numerous "java.lang.OutOfmemoryError: Java heap space" errors as more and more GeoFences are imported. In extreme cases, if the amount of RAM required for storing GeoFences exceeds the default 4GB ceiling the product ships with, and GeoEvent Server software may crash.
Solution or Workaround
1. Increase the amount of system RAM allocated to the GeoEvent Processor Java JVM in the following file:
Make the changes highlighted in the image below:
The procedure updates the default 4096MB (4GB) limit the product ships with to 8192MB (8 GB). This allows importing more GeoFences. If the amount of RAM required to store GeoFences exceeds 8192MB, the amount of RAM allocated to the Java JVM process needs to be increased further.
Only increase the amount of memory allocated to the Java JVM process as high as illustrated above if there is an ample amount of RAM available for the other processes running on the machine, otherwise a large-scale system failure may result.
2. Apart from this, below are the two parameters that can be modified in GeoEvent configuration settings to make sure that JVM is not consuming the extra RAM when importing large quantities of GeoFences.
A. In GeoEvent Manager navigate to Site > Settings > GeoFence Manager Settings.
B. Set 'GeoFence Acceleration Degree' (default == 3) to 0.
C. Set ‘Spatial Index Maximum Level of Details’ (default == 16) – to a low value, something between 4 and 8:
D. Restart the GeoEvent processor Windows service after changing the parameters.
In cases where GeoFences cover a relatively small area, reducing the 'Spatial Index Maximum Level of Details' might be a concern as it may lead to false positives.