Dear Google team,
During our internal performance testing we found out that there's a resource leak (which is causing abnormal native memory consumption) in com.google.api.gax.core.PropertiesProvider class. Test app with google datastore api consumed more than 20 GB of RAM and java process got killed by linux's OOM killer.
Methods
PropertiesProvider#loadProperty(Class<?> loadedClass, String propertiesPath, String key)
and
PropertiesProvider#loadProperty(Properties properties, String propertiesPath, String key)
are loading resources but not closing them(input stream is not closed). So native resources are held using java.util.zip.Inflater (See java.util.zip.GZIPInputStream).
Another proposal is to cache results of property loading by key. Even dumb implementation with synchronization of entire method and HashMap(as cache provider) will work quicker than loading of resource each time.
Tested on linux with latest JDK 8.
BR,
Dionis
Dear Google team,
During our internal performance testing we found out that there's a resource leak (which is causing abnormal native memory consumption) in com.google.api.gax.core.PropertiesProvider class. Test app with google datastore api consumed more than 20 GB of RAM and java process got killed by linux's OOM killer.
Methods
PropertiesProvider#loadProperty(Class<?> loadedClass, String propertiesPath, String key)and
PropertiesProvider#loadProperty(Properties properties, String propertiesPath, String key)are loading resources but not closing them(input stream is not closed). So native resources are held using java.util.zip.Inflater (See java.util.zip.GZIPInputStream).
Another proposal is to cache results of property loading by key. Even dumb implementation with synchronization of entire method and HashMap(as cache provider) will work quicker than loading of resource each time.
Tested on linux with latest JDK 8.
BR,
Dionis